xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] unexpected xpath result with default namespace part 2
- From: Jan <janreimone AT gmail.com>
- To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] unexpected xpath result with default namespace part 2
- Date: Sun, 09 Aug 2009 10:27:45 +0200
Yesterday I posted the same problem. With help of Michael Kay and
http://www.edankert.com/defaultnamespaces.html I got it solved.
Element schema = doc.getRootElement();
XPathContext xpathContext = XPathContext.makeNamespaceContext(schema);
String emptyNS = xpathContext.lookup("");
String baseNS = schema.getNamespaceURI();
if(baseNS != null && baseNS.equals(emptyNS)){
xpathContext.addNamespace("myprefix", baseNS);
}
Then a query must look like this:
//myprefix:COMMON
-
[XOM-interest] unexpected xpath result with default namespace part 2,
T Benjamins, 08/08/2009
- Re: [XOM-interest] unexpected xpath result with default namespace part 2, Jan, 08/09/2009
Archive powered by MHonArc 2.6.24.