Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
xmlmodifyfile.C File Reference

Detailed Description

Example to read, modify and store xml file, using TXMLEngine class The input file, produced by xmlnewfile.C macro is used If you need full xml syntax support, use TXMLParser instead.

#include "TXMLEngine.h"
// scan node and returns number of childs
// for each child create info node with name and number of childs
{
int cnt = 0;
XMLNodePointer_t child = xml.GetChild(node);
while (child) {
cnt++;
// create new <info> node
XMLNodePointer_t info = xml.NewChild(node, xml.GetNS(child), "info");
// set name and num attributes of info node
xml.NewAttr(info, nullptr, "name", xml.GetNodeName(child));
if (numsub > 0) xml.NewIntAttr(info, "num", numsub);
// move it after current node
xml.AddChildAfter(node, info, child);
// set pointer to new node
xml.ShiftToNext(child);
}
return cnt;
}
void xmlmodifyfile(const char* filename = "example.xml")
{
// First create engine
// Now try to parse xml file
if (xmldoc) {
// recursively scan all nodes, insert new when required
ScanNode(xml, xml.DocGetRootElement(xmldoc));
// Save document to file
xml.SaveDoc(xmldoc, "modify.xml");
// Release memory before exit
xml.FreeDoc(xmldoc);
}
}
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 child
void * XMLNodePointer_t
Definition TXMLEngine.h:17
void * XMLDocPointer_t
Definition TXMLEngine.h:20
Author
Sergey Linev

Definition in file xmlmodifyfile.C.