Paul,

 

It looks that you have 3 options:

1)       somehow get the new namespace uri and pass it as parameter - this 
would be the preferred way because namespaces do usually change for a reason 
usually to indicate that they are not backwards compatible

2)       or use the XmlCursors methods toFirstChild() toNextSibling() and test 
the names yourself

3)       or use XmlObject.selectPath("./TrackAndTrace") which is simple enough 
to use the internal XMLBeans XPath implementation.

 

Cezar

 

  _____  

From: Brady, Paul [mailto:paul.br...@airnz.co.nz] 
Sent: Wednesday, November 24, 2010 4:13 PM
To: user@xmlbeans.apache.org
Subject: XmlCursor.toChild() Ignore Namespace?

 

Hi,

How can I navigate to a document location using XMLCursor.toChild() without 
supplying a namespace?

 

My current call looks like:

 

XmlCursor documentCursor = myXmlObject.newCursor();

documentCursor.toChild("http://types.mycompany.com/ServiceMetaTypes/1/1";, 
"TrackAndTrace");

 

This works fine and the TrackAndTrace element is found as it should be. 

I'd like to insulate the logic from changes to the namespace, e.g. the version 
being incremented to http://types.mycompany.com/ServiceMetaTypes/1/2, by 
ignoring the namespace but following never finds anything.

 

XmlCursor documentCursor = myXmlObject.newCursor();

documentCursor.toChild("TrackAndTrace");

 

I need to use the XMLCursor as opposed to using a query as I don't have a query 
engine available in this particular system. 

 

Any help appreciated.

Good planets are hard to find - please think of the environment before you 
print this email.
____________________________________________________________________
CAUTION - This message may contain privileged and confidential 
information intended only for the use of the addressee named above.
If you are not the intended recipient of this message you are hereby 
notified that any use, dissemination, distribution or reproduction 
of this message is prohibited. If you have received this message in 
error please notify Air New Zealand immediately. Any views expressed 
in this message are those of the individual sender and may not 
necessarily reflect the views of Air New Zealand.
_____________________________________________________________________
For more information on the Air New Zealand Group, visit us online
at http://www.airnewzealand.com 
_____________________________________________________________________

Reply via email to