Rather than thinking of it as a restriction, think of it as being a benefit.
Instead of having to write a document-specific XPath, where you have to know
what the prefixes are for a specific document, you can write a generic XPath
that will work on any document containing the specified namespaces,
regardless of what prefixes have been set in that document.

David

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:jaxen-interest-admin@;lists.sourceforge.net]On Behalf Of Andy
Lord
Sent: Wednesday, 6 November 2002 10:52 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [Jaxen] how do i setup a default namespace?


I got caught with this too.. Check the list archives. But I think in your
XML
document you have something like

<tag xmlns="<URI for default>" >
....<default>
   </default>
</tag>


And in Jaxen you use an explicit namespace but with the same URI as in the
XML
document..
The Matching is done by URI not by the ns prefix so...

eg .

      SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
      nsContext.addNamespace( "def" ,"<URI for default>" );
      xp.setNamespaceContext(nsContext);

Then "//def:default should select the first default element above.


Also (as a complete aside!) watch out for setting default namespace URIs in
Stylesheets and
using output type="html" in Xalan, because it may stop the output being
browser
friendly.

HTH




-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest



-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to