Logo ROOT   6.16/01
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
19class TList;
20struct _xmlNode;
21
22class TXMLNode : public TObject {
23
24private:
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
36public:
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;
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
bool Bool_t
Definition: RtypesCore.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:324
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:22
TList * fAttrList
List of Attributes.
Definition: TXMLNode.h:34
TXMLNode(const TXMLNode &)
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:33
_xmlNode * fXMLNode
libxml node
Definition: TXMLNode.h:28
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:38
@ kXMLElementNode
Definition: TXMLNode.h:39
@ kXMLCommentNode
Definition: TXMLNode.h:42
@ kXMLTextNode
Definition: TXMLNode.h:41
@ kXMLAttributeNode
Definition: TXMLNode.h:40
TXMLNode * fNextNode
Next sibling node.
Definition: TXMLNode.h:32
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:30
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 * 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 & operator=(const TXMLNode &)
TXMLNode * fChildren
Children node.
Definition: TXMLNode.h:31
const char * GetNodeName() const
Returns the node's name.
Definition: TXMLNode.cxx:66
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