Logo ROOT   6.10/09
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 #include "TObject.h"
16 
17 #include "TString.h"
18 
19 class TList;
20 struct _xmlNode;
21 
22 class TXMLNode : public TObject {
23 
24 private:
25  TXMLNode(const TXMLNode&); // Not implemented
26  TXMLNode& operator=(const TXMLNode&); // Not implemented
27 
28  _xmlNode *fXMLNode; ///< libxml node
29 
30  TXMLNode *fParent; ///< Parent node
31  TXMLNode *fChildren; ///< Children node
32  TXMLNode *fNextNode; ///< Next sibling node
33  TXMLNode *fPreviousNode; ///< Previous sibling node
34  TList *fAttrList; ///< List of Attributes
35 
36 public:
37  /// This enum is based on libxml tree Enum xmlElementType
43  };
44 
45  TXMLNode(_xmlNode *node, TXMLNode* parent=0, TXMLNode* previous=0);
46 
47  virtual ~TXMLNode();
48 
50  const char *GetNodeName() const;
52  TXMLNode *GetParent() const;
54  TXMLNode *GetPreviousNode() const;
55  const char *GetContent() const;
56  const char *GetText() const;
58 
59  Bool_t HasChildren() const;
60  Bool_t HasNextNode() const;
61  Bool_t HasParent() const;
62  Bool_t HasPreviousNode() const;
63  Bool_t HasAttributes() const;
64 
65  const char *GetNamespaceHref() const;
66  const char *GetNamespacePrefix() const;
67 
68  ClassDef(TXMLNode,0); // XML node under DOM tree
69 };
70 
71 #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:31
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:34
Bool_t HasParent() const
Returns true if node has parent.
Definition: TXMLNode.cxx:182
#define ClassDef(name, id)
Definition: Rtypes.h:297
TXMLNode * fNextNode
Next sibling node.
Definition: TXMLNode.h:32
A doubly linked list.
Definition: TList.h:43
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:38
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:30
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:22
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:28
const char * GetNodeName() const
Returns the node&#39;s name.
Definition: TXMLNode.cxx:66
TXMLNode * fPreviousNode
Previous sibling node.
Definition: TXMLNode.h:33