27 #include <libxml/tree.h>
35 TXMLNode::TXMLNode(xmlNode *node, TXMLNode *parent, TXMLNode *previous) :
36 fXMLNode(node), fParent(parent), fChildren(0), fNextNode(0),
37 fPreviousNode(previous), fAttrList(0)
58 TXMLNode::EXMLElementType TXMLNode::GetNodeType()
const
60 return (TXMLNode::EXMLElementType) fXMLNode->type;
66 const char *TXMLNode::GetNodeName()
const
68 return (
const char *) fXMLNode->name;
74 TXMLNode *TXMLNode::GetChildren()
79 if (fXMLNode->children){
80 fChildren =
new TXMLNode(fXMLNode->children,
this);
89 TXMLNode *TXMLNode::GetParent()
const
97 const char *TXMLNode::GetContent()
const
99 if (fXMLNode->content)
100 return (
const char *) fXMLNode->content;
108 TList *TXMLNode::GetAttributes()
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));
130 TXMLNode *TXMLNode::GetNextNode()
135 if (fXMLNode->next) {
136 fNextNode =
new TXMLNode(fXMLNode->next, fParent,
this);
146 TXMLNode *TXMLNode::GetPreviousNode()
const
148 return fPreviousNode;
154 const char *TXMLNode::GetText()
const
156 if (GetNodeType() == kXMLElementNode && HasChildren()) {
157 if (fXMLNode->children->type == XML_TEXT_NODE)
158 return (
const char *) fXMLNode->children->content;
166 Bool_t TXMLNode::HasChildren()
const
168 return fXMLNode->children ? kTRUE : kFALSE;
174 Bool_t TXMLNode::HasNextNode()
const
176 return fXMLNode->next ? kTRUE : kFALSE;
182 Bool_t TXMLNode::HasParent()
const
184 return fXMLNode->parent ? kTRUE : kFALSE;
190 Bool_t TXMLNode::HasPreviousNode()
const
192 return fXMLNode->prev ? kTRUE : kFALSE;
198 Bool_t TXMLNode::HasAttributes()
const
200 return fXMLNode->properties ? kTRUE : kFALSE;
206 const char *TXMLNode::GetNamespaceHref()
const
209 return (
const char *) fXMLNode->ns->href;
217 const char *TXMLNode::GetNamespacePrefix()
const
220 return (
const char *) fXMLNode->ns->prefix;