Logo ROOT   6.08/07
Reference Guide
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 #ifndef ROOT_TObject
16 #include "TObject.h"
17 #endif
18 
19 #ifndef ROOT_TString
20 #include "TString.h"
21 #endif
22 
23 class TList;
24 struct _xmlNode;
25 
26 class TXMLNode : public TObject {
27 
28 private:
29  TXMLNode(const TXMLNode&); // Not implemented
30  TXMLNode& operator=(const TXMLNode&); // Not implemented
31 
32  _xmlNode *fXMLNode; ///< libxml node
33 
34  TXMLNode *fParent; ///< Parent node
35  TXMLNode *fChildren; ///< Children node
36  TXMLNode *fNextNode; ///< Next sibling node
37  TXMLNode *fPreviousNode; ///< Previous sibling node
38  TList *fAttrList; ///< List of Attributes
39 
40 public:
41  /// This enum is based on libxml tree Enum xmlElementType
47  };
48 
49  TXMLNode(_xmlNode *node, TXMLNode* parent=0, TXMLNode* previous=0);
50 
51  virtual ~TXMLNode();
52 
54  const char *GetNodeName() const;
56  TXMLNode *GetParent() const;
58  TXMLNode *GetPreviousNode() const;
59  const char *GetContent() const;
60  const char *GetText() const;
62 
63  Bool_t HasChildren() const;
64  Bool_t HasNextNode() const;
65  Bool_t HasParent() const;
66  Bool_t HasPreviousNode() const;
67  Bool_t HasAttributes() const;
68 
69  const char *GetNamespaceHref() const;
70  const char *GetNamespacePrefix() const;
71 
72  ClassDef(TXMLNode,0); // XML node under DOM tree
73 };
74 
75 #endif
const char * GetContent() const
Returns the content if any, or 0.
Definition: TXMLNode.cxx:97
TXMLNode(const TXMLNode &)
Bool_t HasChildren() const
Returns true if node has children.
Definition: TXMLNode.cxx:166
TXMLNode * fChildren
Children node.
Definition: TXMLNode.h:35
bool Bool_t
Definition: RtypesCore.h:59
const char * GetText() const
Returns the content of a Text node if node is a TextNode, 0 otherwise.
Definition: TXMLNode.cxx:154
TXMLNode * GetParent() const
Returns the node&#39;s parent if any, returns 0 if no parent.
Definition: TXMLNode.cxx:89
TList * fAttrList
List of Attributes.
Definition: TXMLNode.h:38
Bool_t HasParent() const
Returns true if node has parent.
Definition: TXMLNode.cxx:182
#define ClassDef(name, id)
Definition: Rtypes.h:254
TXMLNode * fNextNode
Next sibling node.
Definition: TXMLNode.h:36
A doubly linked list.
Definition: TList.h:47
TXMLNode * GetNextNode()
Returns the next sibling XMLNode in the DOM tree, if any return 0 if no next node.
Definition: TXMLNode.cxx:130
EXMLElementType
This enum is based on libxml tree Enum xmlElementType.
Definition: TXMLNode.h:42
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
Bool_t HasAttributes() const
Returns true if Element node has attribute.
Definition: TXMLNode.cxx:198
TList * GetAttributes()
Returns a list of node&#39;s attribute if any, returns 0 if no attribute.
Definition: TXMLNode.cxx:108
virtual ~TXMLNode()
Destructor.
Definition: TXMLNode.cxx:45
TXMLNode * fParent
Parent node.
Definition: TXMLNode.h:34
TXMLNode * GetPreviousNode() const
Returns the previous sibling XMLNode in the DOM tree, if any return 0 if no previous node...
Definition: TXMLNode.cxx:146
Mother of all ROOT objects.
Definition: TObject.h:37
TXMLNode & operator=(const TXMLNode &)
Bool_t HasPreviousNode() const
Returns true if has previous node.
Definition: TXMLNode.cxx:190
Bool_t HasNextNode() const
Returns true if has next node.
Definition: TXMLNode.cxx:174
EXMLElementType GetNodeType() const
Returns the node&#39;s type.
Definition: TXMLNode.cxx:58
TXMLNode contains a pointer to xmlNode, which is a node under the DOM tree.
Definition: TXMLNode.h:26
TXMLNode * GetChildren()
Returns the node&#39;s child if any, returns 0 if no child.
Definition: TXMLNode.cxx:74
_xmlNode * fXMLNode
libxml node
Definition: TXMLNode.h:32
const char * GetNodeName() const
Returns the node&#39;s name.
Definition: TXMLNode.cxx:66
TXMLNode * fPreviousNode
Previous sibling node.
Definition: TXMLNode.h:37