You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by jgagnon <Jo...@ll.mit.edu> on 2014/05/08 21:46:35 UTC

Difficulties with using XPath to find an element

I am programmatically generating an XML object hierarchy and then using what
I produced as a template for other work.  I make a copy of the template
structure (using XmlObject.copy() at the root node) and then attempt to
locate a specific node within the structure so that I can then edit the
structure (change element content, or add/remove elements).  I'm having a
problem getting the search to work.  I'm pretty sure I have all the
necessary jar files in the build path (probably more than I need).

When I inspect the XML of the object tree, it appears to have set the
default namespace (i.e. the root node contains: "xmlns:www.xyz.org" - no
prefix).  The elements are rendered with no namespace prefix as well.

When I was doing some earlier experimenting, I was parsing an existing XML
file and in this case, there was a namespace prefix in use, and I was able
to successfully "locate" elements.  Now I cannot, and I don't know why. 
Should I "turn on" a namespace prefix?  Is there some special XmlOption that
I should set?  Any ideas?



--
View this message in context: http://xmlbeans.996285.n3.nabble.com/Difficulties-with-using-XPath-to-find-an-element-tp7505.html
Sent from the XMLBeans User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org