Package org.petitparser.grammar.xml.ast
Class XmlNode
java.lang.Object
org.petitparser.grammar.xml.ast.XmlNode
- Direct Known Subclasses:
XmlAttribute,XmlData,XmlParent
public abstract class XmlNode extends Object implements Iterable<XmlNode>
Abstract XML node.
-
Constructor Summary
Constructors Constructor Description XmlNode() -
Method Summary
Modifier and Type Method Description List<XmlAttribute>getAttributes()Answer the attribute nodes of the receiver.List<XmlNode>getChildren()Answer the child nodes of the receiver.XmlDocumentgetDocument()Answer the document that contains this node, ornullif the node is not part of a document.XmlNodegetFirstChild()Answer the first child of the receiver ornull.XmlNodegetLastChild()Answer the last child of the receiver ornull.XmlNodegetNextSibling()Answer the next sibling of the receiver ornull.XmlNodegetParent()Answer the parent node of the receiver, ornullif there is none.XmlNodegetPreviousSibling()Answer the previous sibling of the receiver ornull.XmlNodegetRoot()Answer the root of the subtree in which this node is found, whether that's a document or another element.Iterator<XmlNode>iterator()Answer an iterator over the receiver, all attributes and nested children.StringtoString()Answer a print string of the receiver.StringtoXmlString()Answer an XML string of the receiver.abstract voidwriteTo(StringBuilder buffer)Writes the XML string of the receiver to abuffer.
-
Constructor Details
-
XmlNode
public XmlNode()
-
-
Method Details
-
getParent
Answer the parent node of the receiver, ornullif there is none. -
getAttributes
Answer the attribute nodes of the receiver. -
getChildren
Answer the child nodes of the receiver. -
iterator
Answer an iterator over the receiver, all attributes and nested children. -
getRoot
Answer the root of the subtree in which this node is found, whether that's a document or another element. -
getDocument
Answer the document that contains this node, ornullif the node is not part of a document. -
getFirstChild
Answer the first child of the receiver ornull. -
getLastChild
Answer the last child of the receiver ornull. -
getNextSibling
Answer the next sibling of the receiver ornull. -
getPreviousSibling
Answer the previous sibling of the receiver ornull. -
toString
Answer a print string of the receiver. -
toXmlString
Answer an XML string of the receiver. -
writeTo
Writes the XML string of the receiver to abuffer.
-