I found this method of querying an XmlObject to return an element containing a particular namespace:
XmlObject xobj = XmlObject.Factory.parse(
"<a xmlns='testA'>\n" +
" <B:b xmlns:B='testB'>\n" +
" <B:x>12345</B:x>\n" +
" </B:b>\n" +
"</a>");
// Use xpath with namespace delcaration to find <B:b> element.
XmlObject bobj = xobj.selectPath(
"declare namespace B='testB'" +
".//B:b")[0];
This is pretty straightforward and can be used for other named namespaces, but how do I do the same for a default namespace? i.e. xmlns=
like this:
XmlObject xobj = XmlObject.Factory.parse(
"<a xmlns='testA'>\n" +
" <b xmlns='testB'>\n" +
" <x>12345</B:x>\n" +
" </b>\n" +
"</a>");
The xmlbeans documentation only refers to named namespaces... Is there a way to accomplish what I am looking for?