library: libXMLIO #include "TXMLEngine.h" |
TXMLEngine
class description - source file - inheritance tree (.pdf)
protected:
XMLAttrPointer_t AllocateAttr(int namelen, int valuelen, XMLNodePointer_t xmlnode)
XMLNodePointer_t AllocateNode(int namelen, XMLNodePointer_t parent)
XMLNsPointer_t FindNs(XMLNodePointer_t xmlnode, const char* nsname)
char* Makenstr(const char* start, int len)
char* Makestr(const char* str)
void OutputValue(Char_t* value, TXMLOutputStream* out)
XMLNodePointer_t ReadNode(XMLNodePointer_t xmlparent, TXMLInputStream* inp, Int_t& resvalue)
void SaveNode(XMLNodePointer_t xmlnode, TXMLOutputStream* out, Int_t layout, Int_t level)
void TruncateNsExtension(XMLNodePointer_t xmlnode)
void UnpackSpecialCharacters(char* target, const char* source, int srclen)
public:
TXMLEngine()
TXMLEngine(const TXMLEngine&)
virtual ~TXMLEngine()
void AddChild(XMLNodePointer_t parent, XMLNodePointer_t child)
void AssignDtd(XMLDocPointer_t xmldoc, const char* dtdname, const char* rootname)
static TClass* Class()
void CleanNode(XMLNodePointer_t xmlnode)
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
void DocSetRootElement(XMLDocPointer_t xmldoc, XMLNodePointer_t xmlnode)
void FreeAttr(XMLNodePointer_t xmlnode, const char* name)
void FreeDoc(XMLDocPointer_t xmldoc)
void FreeNode(XMLNodePointer_t xmlnode)
const char* GetAttr(XMLNodePointer_t xmlnode, const char* name) const
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode)
Int_t GetIntAttr(XMLNodePointer_t node, const char* name)
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode)
const char* GetNodeContent(XMLNodePointer_t xmlnode) const
const char* GetNodeName(XMLNodePointer_t xmlnode) const
XMLNodePointer_t GetParent(XMLNodePointer_t xmlnode)
Bool_t HasAttr(XMLNodePointer_t xmlnode, const char* name)
virtual TClass* IsA() const
Bool_t IsEmptyNode(XMLNodePointer_t)
XMLAttrPointer_t NewAttr(XMLNodePointer_t xmlnode, XMLNsPointer_t, const char* name, const char* value)
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns, const char* name, const char* content = "0")
XMLDocPointer_t NewDoc(const char* version = "0")
XMLAttrPointer_t NewIntAttr(XMLNodePointer_t xmlnode, const char* name, Int_t value)
XMLNsPointer_t NewNS(XMLNodePointer_t xmlnode, const char* reference, const char* name = "0")
TXMLEngine& operator=(const TXMLEngine&)
XMLDocPointer_t ParseFile(const char* filename)
void SaveDoc(XMLDocPointer_t xmldoc, const char* filename, Int_t layout = 1)
void ShiftToNext(XMLNodePointer_t& xmlnode)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
void SkipEmpty(XMLNodePointer_t&)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
void UnlinkFreeNode(XMLNodePointer_t xmlnode)
void UnlinkNode(XMLNodePointer_t node)
Bool_t ValidateDocument(XMLDocPointer_t, Bool_t = kFALSE)
This class is used to write and read xml files.
It makes simplified parsing of xml files, but does not required
any external libraries like libxml2 or other
________________________________________________________________________
TXMLEngine()
default (normal) constructor of TXMLEngine class
~TXMLEngine()
destructor for TXMLEngine object
Bool_t HasAttr(XMLNodePointer_t xmlnode, const char* name)
checks if node has attribute of specified name
const char* GetAttr(XMLNodePointer_t xmlnode, const char* name)
returns value of attribute for xmlnode
Int_t GetIntAttr(XMLNodePointer_t xmlnode, const char* name)
returns value of attribute as integer
XMLAttrPointer_t NewAttr(XMLNodePointer_t xmlnode, XMLNsPointer_t,
const char* name, const char* value)
creates new attribute for xmlnode,
namespaces are not supported for attributes
XMLAttrPointer_t NewIntAttr(XMLNodePointer_t xmlnode,
const char* name,
Int_t value)
create node attribute with integer value
void FreeAttr(XMLNodePointer_t xmlnode, const char* name)
remove attribute from xmlnode
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns,
const char* name, const char* content)
create new child element for parent node
XMLNsPointer_t NewNS(XMLNodePointer_t xmlnode, const char* reference, const char* name)
create namespace attribute for xmlnode.
namespace attribute will be always the first in list of node attributes
void AddChild(XMLNodePointer_t parent, XMLNodePointer_t child)
add child element to xmlnode
void UnlinkNode(XMLNodePointer_t xmlnode)
unlink (dettach) xml node from parent
void FreeNode(XMLNodePointer_t xmlnode)
release all memory, allocated fro this node and
destroyes node itself
void UnlinkFreeNode(XMLNodePointer_t xmlnode)
combined operation. Unlink node and free used memory
const char* GetNodeName(XMLNodePointer_t xmlnode)
returns name of xmlnode
const char* GetNodeContent(XMLNodePointer_t xmlnode)
get contents (if any) of xml node
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode)
returns first child of xml node
XMLNodePointer_t GetParent(XMLNodePointer_t xmlnode)
returns parent of xmlnode
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode)
return next to xmlnode node
void ShiftToNext(XMLNodePointer_t &xmlnode)
shifts specified node to next
void CleanNode(XMLNodePointer_t xmlnode)
remove all childs node from xmlnode
XMLDocPointer_t NewDoc(const char* version)
creates new xml document with provided version
void AssignDtd(XMLDocPointer_t xmldoc, const char* dtdname, const char* rootname)
assignes dtd filename to document
void FreeDoc(XMLDocPointer_t xmldoc)
frees allocated document data and deletes document itself
void SaveDoc(XMLDocPointer_t xmldoc, const char* filename, Int_t layout)
store document content to file
if layout<=0, no any spaces or newlines will be placed between
xmlnodes. Xml file will have minimum size, but nonreadable structure
if (layout>0) each node will be started from new line,
and number of spaces will correspond to structure depth.
void DocSetRootElement(XMLDocPointer_t xmldoc, XMLNodePointer_t xmlnode)
set main (root) node for document
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
returns root node of document
XMLDocPointer_t ParseFile(const char* filename)
parses content of file and tries to produce xml structures
char* Makestr(const char* str)
creates char* variable with copy of provided string
char* Makenstr(const char* str, int len)
creates char* variable with copy of len symbols from provided string
XMLNodePointer_t AllocateNode(int namelen, XMLNodePointer_t parent)
Allocates new xml node with specified namelength
XMLAttrPointer_t AllocateAttr(int namelen, int valuelen, XMLNodePointer_t xmlnode)
Allocate new attribute with specified name length and value length
XMLNsPointer_t FindNs(XMLNodePointer_t xmlnode, const char* name)
define if namespace of that name exists for xmlnode
void TruncateNsExtension(XMLNodePointer_t xmlnode)
removes namespace extension of nodename
void UnpackSpecialCharacters(char* target, const char* source, int srclen)
unpack special symbols, used in xml syntax to code characters
these symbols: '<' - <, '>' - >, '&' - &, '"' - "
void OutputValue(char* value, TXMLOutputStream* out)
output value to output stream
if symbols '<' '&' '>' '"' appears in the string, they
will be encoded to appropriate xml symbols: <, &, >, "
void SaveNode(XMLNodePointer_t xmlnode, TXMLOutputStream* out, Int_t layout, Int_t level)
stream data of xmlnode to output
XMLNodePointer_t ReadNode(XMLNodePointer_t xmlparent, TXMLInputStream* inp, Int_t& resvalue)
Tries to construct xml node from input stream. Node should be
child of xmlparent node or it can be closing tag of xmlparent.
resvalue <= 0 if error
resvalue == 1 if this is endnode of parent
resvalue == 2 if this is child
Inline Functions
Bool_t IsEmptyNode(XMLNodePointer_t)
void SkipEmpty(XMLNodePointer_t&)
Bool_t ValidateDocument(XMLDocPointer_t, Bool_t = kFALSE)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
TXMLEngine TXMLEngine(const TXMLEngine&)
TXMLEngine& operator=(const TXMLEngine&)
Author: Sergey Linev 10.05.2004
Last update: root/xml:$Name: $:$Id: TXMLEngine.cxx,v 1.16 2005/11/22 20:42:37 pcanal Exp $
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.