Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TXMLDocument.cxx
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/**
13\class TXMLDocument
14\ingroup IO
15
16TXMLDocument contains a pointer to an xmlDoc structure, after the
17parser returns a tree built during the document analysis.
18*/
19
20#include "TXMLDocument.h"
21#include "TXMLNode.h"
22#include <libxml/tree.h>
23
24
25
26////////////////////////////////////////////////////////////////////////////////
27/// TXMLDocument constructor.
28
30{
31 if (fXMLDoc) {
33 } else {
34 fRootNode = nullptr;
35 }
36}
37
38////////////////////////////////////////////////////////////////////////////////
39/// TXMLDocument destructor.
40/// Free the global variables that may
41/// have been allocated by the parser.
42
48
49////////////////////////////////////////////////////////////////////////////////
50/// Returns the root element node.
51
53{
54 return fRootNode;
55}
56
57////////////////////////////////////////////////////////////////////////////////
58/// Returns the XML version string or 0 in case there is no document set.
59
60const char *TXMLDocument::Version() const
61{
62 if (fXMLDoc)
63 return (const char *) fXMLDoc->version;
64 return nullptr;
65}
66
67////////////////////////////////////////////////////////////////////////////////
68/// Returns external initial encoding, if any or 0 in case there is no
69/// document set.
70
71const char *TXMLDocument::Encoding() const
72{
73 if (fXMLDoc)
74 return (const char *) fXMLDoc->encoding;
75 return nullptr;
76}
77
78////////////////////////////////////////////////////////////////////////////////
79/// Returns the URI for the document or 0 in case there is no document set.
80
81const char *TXMLDocument::URL() const
82{
83 if (fXMLDoc)
84 return (const char *) fXMLDoc->URL;
85 return nullptr;
86}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
const char * Encoding() const
Returns external initial encoding, if any or 0 in case there is no document set.
_xmlDoc * fXMLDoc
TXMLNode * GetRootNode() const
Returns the root element node.
const char * Version() const
Returns the XML version string or 0 in case there is no document set.
~TXMLDocument() override
TXMLDocument destructor.
const char * URL() const
Returns the URI for the document or 0 in case there is no document set.
TXMLNode * fRootNode
TXMLDocument(const TXMLDocument &)=delete
TXMLNode contains a pointer to xmlNode, which is a node under the DOM tree.
Definition TXMLNode.h:20