ROOT implementation of a XML DOM Parser.
This is an example of how Dom Parser walks the DOM tree recursively. This example will parse any xml file.
To run this program
Requires: person.xml
{
cout <<
attr->GetName() <<
":" <<
attr->GetValue();
}
}
}
}
}
}
}
void DOMRecursive()
{
ParseContext(node);
}
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
virtual TXMLDocument * GetXMLDocument() const
Returns the TXMLDocument.
Int_t ParseFile(const char *filename) override
Parse the XML file where filename is the XML file name.
TXMLAttribute is the attribute of an Element.
TXMLNode * GetRootNode() const
Returns the root element node.
TXMLNode contains a pointer to xmlNode, which is a node under the DOM tree.
TList * GetAttributes()
Returns a list of node's attribute if any, returns 0 if no attribute.
const char * GetContent() const
Returns the content if any, or 0.
TXMLNode * GetNextNode()
Returns the next sibling XMLNode in the DOM tree, if any return 0 if no next node.
TXMLNode * GetChildren()
Returns the node's child if any, returns 0 if no child.
const char * GetNodeName() const
Returns the node's name.
Bool_t HasAttributes() const
Returns true if Element node has attribute.
EXMLElementType GetNodeType() const
Returns the node's type.
void SetValidate(Bool_t val=kTRUE)
The parser will validate the xml file if val = true.
- Author
- Sergey Linev
Definition in file DOMRecursive.C.