cgl.narada.wsinfra.util
Class QNameLocator
java.lang.Object
cgl.narada.wsinfra.util.QNameLocator
- public class QNameLocator
- extends Object
This class helps to determine if a QName is present within the XML.
This uses the XmlCursor interface to help with this operation. Note that
if indeed there is such an element, the cursor is appropriately positioned
at the right location. One can then use xmlText() to retrive the XML text
and parse accordingly to access sub-elements if any within the element.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
moduleName
public String moduleName
getInstance
public static QNameLocator getInstance()
locateQName
public boolean locateQName(XmlCursor cursor,
QName qname)
- Locate the QName based on the specified XmlCursor.
- Returns:
- true If we are able to successfully locate the QName. Please note
that the cursor is positioned at the location where the element is
successfully located. Note that since the cursor is positioned at the
location at which the element is found, this method does not reposition
the cursor's temporarily saved location iff it returns a true.
Please make sure you use cursor.pop() to erase the stack storage
of the temporary location if your program's logic so demands.
Thus, if you did cursor.push() prior to calling this method, and if
a QName has been located by this method. cursor.pop() at a subsequent time
can lead to aberrant results. You need to do cursor.pop() again in such
a scenario.
locateQNameAndDepth
public int locateQNameAndDepth(XmlCursor cursor,
QName qname)