Nope.  XPath spec says that a namestep w/o a prefix is in the
null namespace, not the default namespace.

So, you have to bind a prefix.

        -bob

On Tue, 22 Jun 2004 [EMAIL PROTECTED] wrote:

> On Tuesday 22 June 2004 17:10, you wrote:
> > Document doc = ...;
> > XPath xpath = doc.createXPath("/html:html/html:head/html:title");
> > // manually tell the xpath about our prefix
> > xpath.setNamespaceContext(Collections.singletonMap("html",
> > "http://www.w3.org/1999/xhtml";);
>
> There's no XPath.setNamespaceContext(Map).
>
> > Element titleElem = (Element)xpath.selectSingleNode(doc);
>
> Can't I simply ignore the namespace somehow? I want to apply one XPath
> expression to all docs.
>
> As I workaround I could do a
>
> Node n =
> dom.selectSingleNode("/HTML/*[local-name()='HEAD']/*[local-name()='TITLE']");
>
> but this is ugly... :-(
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
> digital self defense, top technical experts, no vendor pitches,
> unmatched networking opportunities. Visit www.blackhat.com
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>

--
Bob McWhirter        [EMAIL PROTECTED]
The Werken Company   http://werken.com/


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to