41 static inline char *
Name(
void *arg) {
return (
char *)arg +
sizeof(
SXmlAttr_t); }
62 static inline char *
Name(
void *arg) {
return (
char *)arg +
sizeof(
SXmlNode_t); }
73 std::ostream *
fOut{
nullptr};
152 for (
int n = 0;
n < cnt;
n++)
155 for (
int n = 0;
n < cnt;
n++)
293 fInp->get(buf, maxsize, 0);
366 for (
int n = 0;
n <
sz;
n++) {
411 if (*str++ != *
curr++)
431 const char *
chk = str;
451 return (((
symb >=
'a') && (
symb <=
'z')) || ((
symb >=
'A') && (
symb <=
'Z')) || (
symb ==
'_') ||
517 if ((*
curr !=
'\"') && (*
curr !=
'\''))
670 node->
fAttr =
nullptr;
758 char *
nsname =
new char[namelen + 7];
762 node->
fAttr =
nullptr;
812 if (!parent || !
child)
821 if (!
pnode->fLastChild) {
837 if (!parent || !
child)
850 if (!
pnode->fLastChild)
869 Error(
"InsertChildAfter",
"Specified afternode is not in childs list of parent node");
970 const char *
nodename =
"xml-stylesheet";
981 NewAttr(node,
nullptr,
"title", title);
1027 if (parent->
fChild == node) {
1033 while (ch->
fNext != node)
1041 node->
fNext =
nullptr;
1277 doc->fDtdName =
nullptr;
1278 doc->fDtdRoot =
nullptr;
1290 delete[]
doc->fDtdName;
1292 delete[]
doc->fDtdRoot;
1305 delete[]
doc->fDtdName;
1306 delete[]
doc->fDtdRoot;
1372 std::filesystem::path
rel = std::filesystem::proximate(
fname, std::filesystem::current_path());
1375 if (
rel.is_absolute())
1394 if (!
inp.IsFileOpen()) {
1434 if (!
inp->EndOfStream())
1437 if (
inp->EndOfStream()) {
1528 char *res =
new char[
len + 1];
1538 if (!str || (
len == 0))
1540 char *res =
new char[
len + 1];
1557 node->
fNs =
nullptr;
1558 node->
fAttr =
nullptr;
1561 node->
fNext =
nullptr;
1580 attr->fNext =
nullptr;
1646 (*(
source + 4) ==
';')) {
1683 char *find =
nullptr;
1684 while ((find =
strpbrk(last,
"<&>\"")) !=
nullptr) {
1692 else if (
symb ==
'>')
1694 else if (
symb ==
'&')
1695 out->Write(
"&");
1696 else if (
symb ==
'\'')
1697 out->Write(
"'");
1699 out->Write(
""");
1717 out->Put(
' ', level);
1788 out->Put(
' ', level);
1817 if (!
inp->SkipSpaces()) {
1826 while (
inp->CheckFor(
"<!--")) {
1846 if (!
inp->SkipSpaces() && !
inp->EndOfStream()) {
1855 if (*
inp->fCurrent !=
'<') {
1873 if (
inp->NumEntities() <= 0) {
1882 while (*
curr != 0) {
1902 if (
entity->IsSystem()) {
1945 if (!
inp->ShiftCurrent())
1949 if (*
inp->fCurrent ==
'/') {
1951 if (!
inp->ShiftCurrent())
1953 if (!
inp->SkipSpaces())
1971 if (!
inp->ShiftCurrent(
len))
1974 if (!
inp->SkipSpaces())
1976 if (*
inp->fCurrent !=
'>')
1978 if (!
inp->ShiftCurrent())
1989 if (*
inp->fCurrent ==
'!') {
1991 if (!
inp->ShiftCurrent())
1993 if (!
inp->CheckFor(
"DOCTYPE")) {
1997 if (!
inp->SkipSpaces()) {
2008 if (!
inp->ShiftCurrent(
len)) {
2012 if (!
inp->SkipSpaces()) {
2018 if (
inp->CheckFor(
"[")) {
2019 if (!
inp->SkipSpaces())
2022 if (
inp->CheckFor(
"<!ENTITY")) {
2024 if (!
inp->SkipSpaces()) {
2028 Int_t namelen =
inp->LocateIdentifier();
2034 if (!
inp->ShiftCurrent(namelen)) {
2038 if (!
inp->SkipSpaces()) {
2043 if (
inp->CheckFor(
"SYSTEM")) {
2044 if (!
inp->SkipSpaces()) {
2064 if (*
inp->fCurrent !=
'>') {
2068 if (!
inp->ShiftCurrent()) {
2078 if (
inp->CheckFor(
"<!ELEMENT")) {
2080 if (!
inp->SkipSpaces()) {
2084 Int_t namelen =
inp->LocateIdentifier();
2090 if (!
inp->ShiftCurrent(namelen)) {
2094 if (!
inp->SkipSpaces()) {
2099 if (!
inp->CheckFor(
"(")) {
2103 if (
inp->SearchFor(
")") <= 0) {
2109 if (*
inp->fCurrent !=
'>') {
2113 if (!
inp->ShiftCurrent()) {
2125 if (!
inp->CheckFor(
"]")) {
2131 if (!
inp->CheckFor(
">")) {
2145 if (*
inp->fCurrent ==
'?') {
2146 if (!
inp->ShiftCurrent())
2153 if (!
inp->SkipSpaces())
2167 if (
colon && parent) {
2173 if (!
inp->ShiftCurrent(
len))
2177 if (!
inp->SkipSpaces())
2183 if (!
inp->ShiftCurrent())
2185 if (*
inp->fCurrent ==
'>') {
2186 if (!
inp->ShiftCurrent())
2203 if (!
inp->ShiftCurrent())
2271 Error(
method,
"Node cannot be closed with > symbol at line %d, for instance <?xml ... ?> node",
linenumber);
2274 Error(
method,
"Error in xml comments definition at line %d, must be <!-- comments -->",
linenumber);
2284 case -1:
Error(
method,
"Unexpected end of xml file");
break;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
const_iterator begin() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
The TNamed class is the base class for all named ROOT classes.
Int_t GetLast() const override
Return index of last object in array.
void Add(TObject *obj) override
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TString & Append(const char *cs)
Bool_t AddRawLine(XMLNodePointer_t parent, const char *line)
Add just line into xml file Line should has correct xml syntax that later it can be decoded by xml pa...
XMLNodePointer_t AllocateNode(int namelen, XMLNodePointer_t parent)
Allocates new xml node with specified name length.
const char * GetNSName(XMLNsPointer_t ns)
return name id of namespace
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns, const char *name, const char *content=nullptr)
create new child element for parent node
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xmlnode
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
void SaveSingleNode(XMLNodePointer_t xmlnode, TString *res, Int_t layout=1)
convert single xmlnode (and its child node) to string if layout<=0, no any spaces or newlines will be...
void SaveDoc(XMLDocPointer_t xmldoc, const char *filename, Int_t layout=1)
store document content to file if layout<=0, no any spaces or newlines will be placed between xmlnode...
Bool_t AddComment(XMLNodePointer_t parent, const char *comment)
Adds comment line to the node.
void CleanNode(XMLNodePointer_t xmlnode)
remove all children node from xmlnode
void UnlinkNode(XMLNodePointer_t node)
unlink (detach) xmlnode from parent
void AssignDtd(XMLDocPointer_t xmldoc, const char *dtdname, const char *rootname)
assigns dtd filename to document
void FreeDoc(XMLDocPointer_t xmldoc)
frees allocated document data and deletes document itself
XMLNodePointer_t DocGetRootElement(XMLDocPointer_t xmldoc)
returns root node of document
void AddChild(XMLNodePointer_t parent, XMLNodePointer_t child)
add child element to xmlnode
Bool_t AddStyleSheet(XMLNodePointer_t parent, const char *href, const char *type="text/css", const char *title=nullptr, int alternate=-1, const char *media=nullptr, const char *charset=nullptr)
Adds style sheet definition to the specified node Creates <?xml-stylesheet alternate="yes" title="com...
XMLAttrPointer_t NewIntAttr(XMLNodePointer_t xmlnode, const char *name, Int_t value)
create node attribute with integer value
Bool_t AddDocComment(XMLDocPointer_t xmldoc, const char *comment)
add comment line to the top of the document
~TXMLEngine() override
destructor for TXMLEngine object
void AddNodeContent(XMLNodePointer_t xmlnode, const char *content, Int_t len=0)
add new content of the xmlnode old content will be preserved, one could mix content with child nodes
Bool_t HasAttr(XMLNodePointer_t xmlnode, const char *name)
checks if node has attribute of specified name
char * Makestr(const char *str)
creates char* variable with copy of provided string
Bool_t IsXmlNode(XMLNodePointer_t xmlnode)
return kTRUE is this is normal xmlnode
void SaveNode(XMLNodePointer_t xmlnode, TXMLOutputStream *out, Int_t layout, Int_t level)
stream data of xmlnode to output
Bool_t IsContentNode(XMLNodePointer_t xmlnode)
return kTRUE is this is special node with content
XMLAttrPointer_t GetNextAttr(XMLAttrPointer_t xmlattr)
return next attribute in the list
XMLDocPointer_t ParseStream(TXMLInputStream *input)
parses content of the stream and tries to produce xml structures
XMLNodePointer_t ReadSingleNode(const char *src)
read single xmlnode from provided string
const char * GetNSReference(XMLNsPointer_t ns)
return reference id of namespace
char * Makenstr(const char *start, int len)
creates char* variable with copy of len symbols from provided string
Bool_t ValidateVersion(XMLDocPointer_t doc, const char *version=nullptr)
check that first node is xml processing instruction with correct xml version number
static Bool_t VerifyFilePath(const char *fname)
Checked that filename does not contains relative path below current directory.
void SetNodeContent(XMLNodePointer_t xmlnode, const char *content, Int_t len=0)
set content of the xmlnode if old node content was exists, it will be replaced
const char * GetNodeContent(XMLNodePointer_t xmlnode)
get contents (if any) of xmlnode
void DisplayError(Int_t error, Int_t linenumber, Bool_t is_parse_file=kTRUE)
Displays xml parsing error.
XMLNsPointer_t GetNS(XMLNodePointer_t xmlnode)
return namespace attribute (if exists)
Bool_t IsEmptyNode(XMLNodePointer_t xmlnode)
return kTRUE is this is node with special data like comments to data processing instructions
Bool_t IsCommentNode(XMLNodePointer_t xmlnode)
return kTRUE is this is special node with content
const char * GetAttrName(XMLAttrPointer_t xmlattr)
return name of the attribute
XMLAttrPointer_t GetFirstAttr(XMLNodePointer_t xmlnode)
return first attribute in the list, namespace (if exists) will be skipped
const char * GetNodeName(XMLNodePointer_t xmlnode)
returns name of xmlnode
Bool_t AddDocRawLine(XMLDocPointer_t xmldoc, const char *line)
Add just line on the top of xml document Line should has correct xml syntax that later it can be deco...
XMLNodePointer_t ReadNode(XMLNodePointer_t xmlparent, TXMLInputStream *inp, Int_t &resvalue)
Tries to construct xml node from input stream.
void FreeAttr(XMLNodePointer_t xmlnode, const char *name)
remove attribute from xmlnode
void OutputValue(char *value, TXMLOutputStream *out)
output value to output stream if symbols '<' '&' '>' '"' ''' appears in the string,...
const char * GetAttr(XMLNodePointer_t xmlnode, const char *name)
returns value of attribute for xmlnode
void AddChildAfter(XMLNodePointer_t parent, XMLNodePointer_t child, XMLNodePointer_t afternode)
Insert new child node after already existing node.
Bool_t AddDocStyleSheet(XMLDocPointer_t xmldoc, const char *href, const char *type="text/css", const char *title=nullptr, int alternate=-1, const char *media=nullptr, const char *charset=nullptr)
Add style sheet definition on the top of document.
XMLNsPointer_t NewNS(XMLNodePointer_t xmlnode, const char *reference, const char *name=nullptr)
create namespace attribute for xmlnode.
Int_t GetIntAttr(XMLNodePointer_t node, const char *name)
returns value of attribute as integer
XMLDocPointer_t NewDoc(const char *version="1.0")
creates new xml document with provided version
XMLNsPointer_t FindNs(XMLNodePointer_t xmlnode, const char *nsname)
define if namespace of that name exists for xmlnode
void UnlinkFreeNode(XMLNodePointer_t xmlnode)
combined operation. Unlink node and free used memory
XMLDocPointer_t ParseFile(const char *filename, Int_t maxbuf=100000)
Parses content of file and tries to produce xml structures.
TXMLEngine()
if true, do not create comments nodes in document during parsing
XMLAttrPointer_t AllocateAttr(int namelen, int valuelen, XMLNodePointer_t xmlnode)
Allocate new attribute with specified name length and value length.
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 FreeAllAttr(XMLNodePointer_t xmlnode)
Free all attributes of the node.
XMLDocPointer_t ParseString(const char *xmlstring)
parses content of string and tries to produce xml structures
void FreeNode(XMLNodePointer_t xmlnode)
release all memory, allocated from this node and destroys node itself
const char * GetAttrValue(XMLAttrPointer_t xmlattr)
return value of attribute
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
return next to xmlnode node if realnode==kTRUE, any special nodes in between will be skipped
void SkipEmpty(XMLNodePointer_t &xmlnode)
Skip all current empty nodes and locate on first "true" node.
void ShiftToNext(XMLNodePointer_t &xmlnode, Bool_t realnode=kTRUE)
shifts specified node to next if realnode==kTRUE, any special nodes in between will be skipped
void DocSetRootElement(XMLDocPointer_t xmldoc, XMLNodePointer_t xmlnode)
set main (root) node for document
XMLNodePointer_t GetParent(XMLNodePointer_t xmlnode)
returns parent of xmlnode
void AddChildFirst(XMLNodePointer_t parent, XMLNodePointer_t child)
add node as first child
TXMLEntity(const TString &name, const TString &value, Bool_t sys)
TXMLEntity()
is system (file)
TXMLOutputStream(TString *outstr, Int_t bufsize=20000)
void OutputChar(char symb)
void Put(char symb, Int_t cnt=1)
void Write(const char *str)
TXMLOutputStream(const char *filename, Int_t bufsize=20000)
virtual ~TXMLOutputStream()
static char * Name(void *arg)
static char * Name(void *arg)