27 #include <libxml/tree.h> 36 fXMLNode(node), fParent(parent), fChildren(0), fNextNode(0),
37 fPreviousNode(previous), fAttrList(0)
68 return (
const char *) fXMLNode->name;
79 if (fXMLNode->children){
80 fChildren =
new TXMLNode(fXMLNode->children,
this);
99 if (fXMLNode->content)
100 return (
const char *) fXMLNode->content;
113 if (!HasAttributes())
116 fAttrList =
new TList();
117 xmlAttr *attr_node = fXMLNode->properties;
118 for (; attr_node; attr_node = attr_node->next) {
119 fAttrList->Add(
new TXMLAttr((
const char *) attr_node->name,
120 (
const char *) attr_node->children->content));
135 if (fXMLNode->next) {
136 fNextNode =
new TXMLNode(fXMLNode->next, fParent,
this);
148 return fPreviousNode;
156 if (GetNodeType() == kXMLElementNode && HasChildren()) {
157 if (fXMLNode->children->type == XML_TEXT_NODE)
158 return (
const char *) fXMLNode->children->content;
209 return (
const char *) fXMLNode->ns->href;
220 return (
const char *) fXMLNode->ns->prefix;
const char * GetContent() const
Returns the content if any, or 0.
TXMLNode(const TXMLNode &)
Bool_t HasChildren() const
Returns true if node has children.
const char * GetText() const
Returns the content of a Text node if node is a TextNode, 0 otherwise.
TXMLNode * GetParent() const
Returns the node's parent if any, returns 0 if no parent.
Bool_t HasParent() const
Returns true if node has parent.
TXMLNode * GetNextNode()
Returns the next sibling XMLNode in the DOM tree, if any return 0 if no next node.
EXMLElementType
This enum is based on libxml tree Enum xmlElementType.
const char * GetNamespaceHref() const
Returns the URL for the namespace, or 0 if no namespace.
const char * GetNamespacePrefix() const
Returns prefix for the namespace, or 0 if no namespace.
Bool_t HasAttributes() const
Returns true if Element node has attribute.
TList * GetAttributes()
Returns a list of node's attribute if any, returns 0 if no attribute.
virtual ~TXMLNode()
Destructor.
TXMLAttribute is the attribute of an Element.
TXMLNode * GetPreviousNode() const
Returns the previous sibling XMLNode in the DOM tree, if any return 0 if no previous node...
Bool_t HasPreviousNode() const
Returns true if has previous node.
Bool_t HasNextNode() const
Returns true if has next node.
EXMLElementType GetNodeType() const
Returns the node's type.
TXMLNode contains a pointer to xmlNode, which is a node under the DOM tree.
TXMLNode * GetChildren()
Returns the node's child if any, returns 0 if no child.
const char * GetNodeName() const
Returns the node's name.