[oXygen-user] Xpath Evaluator Bug?

George Cristian Bina
Fri Feb 6 13:28:31 CST 2004


Dear Peter,

When you write
    /html/body/xforms:group
that actually means the
    html element from no namespace
    the body element from no namespace
    the grop element from http://www.w3.org/2002/xforms/cr" namespace

When you specify an unqualified element in XPath that means it belongs to no
namespace. More there is no way to specify an element from the default
namespace  (with default namespace != no namespace) in XPath.

In order to refer to such elements you can map the default namespace to a
prefix using

xmlns:prefix="defaultNamespace"

and then use prefix:element or use instead of

    element

a construct like

    *[local-name()='element']

Oxygen uses Xalan for XPath evaluation. It has an implementation specific
behavior that allows you to access an element from the default namespace if
you specify it as
:element
so /:html/:body/xforms:group will give you the expected result.
However this is not recommended and you should use one of the alternatives I
specified above:
    /*[local-name()='html']/*[local-name()='body']/xforms:group
or
    /html:html/html:body/xforms:group
    together with adding a mapping from html to
"http://www.w3.org/1999/xhtml"

Best Regards,
 George
-------------------------------------------------------
George Cristian Bina mailto:
<oXygen/> XML Editor - http://www.oxygenxml.com/


----- Original Message -----
From: "Peter Charles" <>
To: <>
Sent: Friday, February 06, 2004 9:07 PM
Subject: [oXygen-user] Xpath Evaluator Bug?


> Hello,
>
> Using this file,  I was able to match the expression //xforms:group,
> however, I was not able to match the expression /html/body/xforms:group.
> When I copied the found xpath expression from the //xforms:group query
> (/html[1]/body[1]/xforms:group[1]/xforms:label[1]) , the expression
> would not evaluate.
>
> Using version 3.0
>
>
>
> -----<CDE/>-----
> Center for Document Engineering
> University of California, Berkeley
> cde.berkeley.edu
>
>


----------------------------------------------------------------------------
----


> _______________________________________________
> oXygen-user mailing list
> 
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>



More information about the oXygen-user mailing list