Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TXMLNode.h
Go to the documentation of this file.
1// @(#)root/xmlparser:$Id$
2// Author: Jose Lo 12/4/2005
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TXMLNode
13#define ROOT_TXMLNode
14
15#include "TObject.h"
16
17class TList;
18struct _xmlNode;
19
20class TXMLNode : public TObject {
21
22private:
23 TXMLNode(const TXMLNode&) = delete;
24 TXMLNode& operator=(const TXMLNode&) = delete;
25
26 _xmlNode *fXMLNode; ///< libxml node
27
28 TXMLNode *fParent; ///< Parent node
29 TXMLNode *fChildren; ///< Children node
30 TXMLNode *fNextNode; ///< Next sibling node
31 TXMLNode *fPreviousNode; ///< Previous sibling node
32 TList *fAttrList; ///< List of Attributes
33
34public:
35 /// This enum is based on libxml tree Enum xmlElementType
41 };
42
43 TXMLNode(_xmlNode *node, TXMLNode* parent=0, TXMLNode* previous=0);
44
45 virtual ~TXMLNode();
46
48 const char *GetNodeName() const;
50 TXMLNode *GetParent() const;
53 const char *GetContent() const;
54 const char *GetText() const;
56
57 Bool_t HasChildren() const;
58 Bool_t HasNextNode() const;
59 Bool_t HasParent() const;
60 Bool_t HasPreviousNode() const;
61 Bool_t HasAttributes() const;
62
63 const char *GetNamespaceHref() const;
64 const char *GetNamespacePrefix() const;
65
66 ClassDef(TXMLNode,0); // XML node under DOM tree
67};
68
69#endif
#define ClassDef(name, id)
Definition Rtypes.h:325
A doubly linked list.
Definition TList.h:44
Mother of all ROOT objects.
Definition TObject.h:37
TXMLNode contains a pointer to xmlNode, which is a node under the DOM tree.
Definition TXMLNode.h:20
TList * fAttrList
List of Attributes.
Definition TXMLNode.h:32
TList * GetAttributes()
Returns a list of node's attribute if any, returns 0 if no attribute.
Definition TXMLNode.cxx:108
TXMLNode * fPreviousNode
Previous sibling node.
Definition TXMLNode.h:31
_xmlNode * fXMLNode
libxml node
Definition TXMLNode.h:26
Bool_t HasChildren() const
Returns true if node has children.
Definition TXMLNode.cxx:166
virtual ~TXMLNode()
Destructor.
Definition TXMLNode.cxx:45
Bool_t HasParent() const
Returns true if node has parent.
Definition TXMLNode.cxx:182
const char * GetText() const
Returns the content of a Text node if node is a TextNode, 0 otherwise.
Definition TXMLNode.cxx:154
const char * GetContent() const
Returns the content if any, or 0.
Definition TXMLNode.cxx:97
EXMLElementType
This enum is based on libxml tree Enum xmlElementType.
Definition TXMLNode.h:36
@ kXMLElementNode
Definition TXMLNode.h:37
@ kXMLCommentNode
Definition TXMLNode.h:40
@ kXMLTextNode
Definition TXMLNode.h:39
@ kXMLAttributeNode
Definition TXMLNode.h:38
TXMLNode * fNextNode
Next sibling node.
Definition TXMLNode.h:30
const char * GetNamespaceHref() const
Returns the URL for the namespace, or 0 if no namespace.
Definition TXMLNode.cxx:206
const char * GetNamespacePrefix() const
Returns prefix for the namespace, or 0 if no namespace.
Definition TXMLNode.cxx:217
TXMLNode * fParent
Parent node.
Definition TXMLNode.h:28
TXMLNode * GetNextNode()
Returns the next sibling XMLNode in the DOM tree, if any return 0 if no next node.
Definition TXMLNode.cxx:130
Bool_t HasPreviousNode() const
Returns true if has previous node.
Definition TXMLNode.cxx:190
TXMLNode(_xmlNode *node, TXMLNode *parent=0, TXMLNode *previous=0)
TXMLNode * GetParent() const
Returns the node's parent if any, returns 0 if no parent.
Definition TXMLNode.cxx:89
TXMLNode(const TXMLNode &)=delete
TXMLNode * GetPreviousNode() const
Returns the previous sibling XMLNode in the DOM tree, if any return 0 if no previous node.
Definition TXMLNode.cxx:146
TXMLNode * GetChildren()
Returns the node's child if any, returns 0 if no child.
Definition TXMLNode.cxx:74
TXMLNode * fChildren
Children node.
Definition TXMLNode.h:29
const char * GetNodeName() const
Returns the node's name.
Definition TXMLNode.cxx:66
TXMLNode & operator=(const TXMLNode &)=delete
Bool_t HasNextNode() const
Returns true if has next node.
Definition TXMLNode.cxx:174
Bool_t HasAttributes() const
Returns true if Element node has attribute.
Definition TXMLNode.cxx:198
EXMLElementType GetNodeType() const
Returns the node's type.
Definition TXMLNode.cxx:58