Package ghidra.xml
Class AbstractXmlPullParser
java.lang.Object
ghidra.xml.AbstractXmlPullParser
- All Implemented Interfaces:
XmlPullParser
- Direct Known Subclasses:
NonThreadedXmlPullParserImpl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintDiscards the current subtree.intdiscardSubTree(XmlElement element) Discards a subtree.intdiscardSubTree(String elementName) Discards the current subtree.end()Returns the next element, which must be an end element.end(XmlElement element) Returns the next element, which must be an end element, and must match the supplied XmlElement's name (presumably the start element of the subtree).intReturns the current column number where the parser is (note that this may actually be ahead of where you think it is because of look-ahead and caching).intThe current element level, as if the XML document was a tree.intReturns the current line number where the parser is (note that this may actually be ahead of where you think it is because of look-ahead and caching).Returns the next element, which must be a start element, and must be one of the supplied names (if provided).Returns the next element, which must be a start element, and must be one of the supplied names (if provided).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.xml.XmlPullParser
dispose, getName, getProcessingInstruction, hasNext, isPullingContent, next, peek, setPullingContent
-
Constructor Details
-
AbstractXmlPullParser
public AbstractXmlPullParser()
-
-
Method Details
-
end
Description copied from interface:XmlPullParserReturns the next element, which must be an end element. The name doesn't matter. This method throws an XmlException if the next element is not an end element. Use this method when you really know you're matching the right end and want to avoid extra constraint checks.- Specified by:
endin interfaceXmlPullParser- Returns:
- the next element (which is an end element)
-
end
Description copied from interface:XmlPullParserReturns the next element, which must be an end element, and must match the supplied XmlElement's name (presumably the start element of the subtree). This method throws an XmlException if the next element is not an end element, or if the name doesn't match.- Specified by:
endin interfaceXmlPullParser- Parameters:
element- the presumed start element to match names- Returns:
- the next element (which is an end element)
-
getColumnNumber
public int getColumnNumber()Description copied from interface:XmlPullParserReturns the current column number where the parser is (note that this may actually be ahead of where you think it is because of look-ahead and caching).- Specified by:
getColumnNumberin interfaceXmlPullParser- Returns:
- the current column number
-
getCurrentLevel
public int getCurrentLevel()Description copied from interface:XmlPullParserThe current element level, as if the XML document was a tree. The root element is at level 0. Each child is at a level one higher than its parent. Note that this is the same as peek().getLevel().- Specified by:
getCurrentLevelin interfaceXmlPullParser- Returns:
- the current element level
-
getLineNumber
public int getLineNumber()Description copied from interface:XmlPullParserReturns the current line number where the parser is (note that this may actually be ahead of where you think it is because of look-ahead and caching).- Specified by:
getLineNumberin interfaceXmlPullParser- Returns:
- the current line number
-
start
Description copied from interface:XmlPullParserReturns the next element, which must be a start element, and must be one of the supplied names (if provided). This method is very useful for starting a subtree, and throws an XmlException if the next element does not conform to your specification.- Specified by:
startin interfaceXmlPullParser- Parameters:
names- optional vararg Strings which start element name must be one of- Returns:
- the next element (which is a start element)
-
softStart
Description copied from interface:XmlPullParserReturns the next element, which must be a start element, and must be one of the supplied names (if provided). This method is very useful for starting a subtree, but differs from start(...) in that failures are soft. This means that if the next element isn't a start element, or doesn't match one of the optional provided names, null is returned (instead of raising an XmlException).- Specified by:
softStartin interfaceXmlPullParser- Parameters:
names- optional vararg Strings which start element name must be one of- Returns:
- the next element (which is a start element) or null
-
discardSubTree
public int discardSubTree()Description copied from interface:XmlPullParserDiscards the current subtree. If the current element (peek()) is a content or end element, then just that element is discarded. If it's a start element, then the entire subtree starting with the start element is discarded (i.e. next() is called until the current element is now the element after the subtree's end element).- Specified by:
discardSubTreein interfaceXmlPullParser- Returns:
- the number of elements discarded
-
discardSubTree
Description copied from interface:XmlPullParserDiscards a subtree. The element provided is used as the "start" of the subtree (although it doesn't actually have to be a start element; only its name and level are used). The queue of elements is discarded such that the last element discarded is an end element, has the same name as the provided element, and is the same level as the provided element. If the provided element's level is higher than the current level, then nothing is discarded.- Specified by:
discardSubTreein interfaceXmlPullParser- Parameters:
element- the element provided as the "start" element- Returns:
- the number of elements discarded
-
discardSubTree
Description copied from interface:XmlPullParserDiscards the current subtree. The current element must be a start element, and must be named name, otherwise an XmlException is thrown.- Specified by:
discardSubTreein interfaceXmlPullParser- Parameters:
elementName- what the current start element must be named- Returns:
- the number of elements discarded
-