Page 1 of 1

Defining namespace prefixes for the Xpath evaluator

Posted: Mon Dec 13, 2004 2:34 pm
by beleta
If an XML document has default namespace:

Code: Select all

xmlns="something"
there is no way to match unprefixed elements (from the default namespace) using the standalone XPath evaluator, and most times is not practicable to add a prefix to the namespace definition and all unprefixed elements.

Both Xalan and Saxon provide in its XPath API ways to define namespace prefixes when evaluating an standalone XPath expression.

Please provide a mechanism to allow the user to define namespace prefixes that would be available to the standalone Xpath evaluator.

Thank you in advance.

Jose M Beleta

Posted: Mon Dec 13, 2004 5:27 pm
by george
Hi Jose,

Oxygen does provide a handling for default namespaces, unfortunatelly this feature is not present in the user guide. If the document has a default namespace then oXygen will bind that to the first free prefix from

default
default1
default2
...

Best Regards,
George

Suggestion

Posted: Thu Dec 30, 2004 11:56 pm
by dsmiley
I suggest that it not be necessary to enter "default" as a magic namespace prefix. This is unintuitive.

Also... it would be nice if in the status bar or somewhere else displayed the xpath expression to your current location. Perhaps underneath the "model" tab area. I don't know.

Re: Suggestion

Posted: Mon Jan 03, 2005 10:40 am
by george
dsmiley wrote:I suggest that it not be necessary to enter "default" as a magic namespace prefix. This is unintuitive.<snip/>
This will be documented in the user guide. Any suggestions to make it more intuitive? And I think it is necessary, otherwise one cannot access a namespaced node.

Best Regards,
George

Posted: Tue Jan 04, 2005 3:53 am
by dsmiley
It isn't necessary. A namespace'ed node can be accessed as it works currently -- with the appropriate prefix.

Posted: Tue Jan 04, 2005 10:56 am
by george
Hi David,

Right, but we were talking about the case when there is no prefix, example:

Code: Select all


<test xmlns="http://test.com/test">
<a>a</a>
</test>
In this case test and a from the XPath expression test/a mean
test element from no namespace
a element from no namespace
and the XPath expression will not match any node in the sample document because there the test and a elements are from the http://test.com/test namespace.
I such a case oXygen will map default to the http://test.com/test namespace and the user can write default:test/default:a

Hope that clarifies things.

Best Regards,
George