Introduce new package xml.
Originally proposed by Hans Essel from GSI. Main implementation by Sergey Linev from GSI. Adaptation to ROOT framework by Rene Brun. "xml" is an optional package that can be used to write file.xml instead of file.root. XML files do not have any advantages compared to the normal ROOT files, except that the information in these files can be edited via a normal editor. The main motivation for this new format is to facilitate the communication with other non ROOT applications. Currently writing and reading XML files is limited to ROOT applications. It is our intention to develop a simple reader independent of the ROOT libraries that could be used as an example for real applications. The XML format should be used only for small data volumes, typically histogram files, pictures, geometries, calibrations. The XML file is built in memory before being dumped to disk. Like for normal ROOT files, XML files use the same I/O mechanism exploiting the ROOT/CINT dictionary. Any class having a dictionary can be saved in XML format. This first implementation does not support subdirectories or Trees. The shared library libRXML.so may be loaded dynamically via gSystem->Load("libRXML"). This library is automatically loaded by the plugin manager as soon as a XML file is created via, eg TFile::Open("file.xml","recreate"); TFile::Open returns a TXMLFile object. When a XML file is open in write mode, one can use the normal TObject::Write to write an object in the file. Alternatively one can use the new functions TDirectory::WriteObject and TDirectory::WriteObjectAny to write a TObject* or any class not deriving from TObject. example of a session saving a histogram to a XML file ===================================================== TFile *f = TFile::Open("Example.xml","recreate"); TH1F *h = new TH1F("h","test",1000,-2,2); h->FillRandom("gaus"); h->Write(); delete f; example of a session reading the histogram from the file ======================================================== TFile *f = TFile::Open("Example.xml"); TH1F *h = (TH1F*)f->Get("h"); h->Draw(); A new option in the canvas "File" menu is available to save a TCanvas as a XML file. One can also do canvas->Print("Example.xml"); Configuring ROOT with the option "xml" ====================================== The XML package uses the public XML parser and toolkit from Gnome. You should download the latest version 2-6.9 from http://www.xmlsoft.org/downloads.html. On Unix systems dowload "libxml2-2.6.9.tar.gz" and create XMLDIR pointing to the directory libxml2-2.6.9. in the XMLDIR directory, run the normal ./configure make On Windows, from the same web site download libxml2-2.6.9.win32.zip iconv-1.9.1.win32.zip unzip the two files, then copy the file iconv.h from the iconv/include file to $XMLDIR/include. Also copy iconv.dll, iconv.lib and iconv_a.lib from the iconv/lib directory to $XMLDIR/lib. You are now ready to configure ROOT with the XML option. do: ./configure -enable-xml -enable-xxxxx, etc documentation ============= The "xml" package is currently under development. A more complete documentation will be provided shortly in the classes reference guide. See classes TXMLFile, TXMLKey, TXMLBuffer, TXMLEngine, TXMLSetup and TXMLDtdGenerator. An example of XML file corresponding to the small example below can be found at http://root.cern.ch/root/Example.xml. git-svn-id: http://root.cern.ch/svn/root/trunk@8860 27541ba8-7e3a-0410-8455-c3a389f83636
Showing
- Makefile 1 addition, 1 deletionMakefile
- config/Makefile.in 4 additions, 0 deletionsconfig/Makefile.in
- configure 45 additions, 0 deletionsconfigure
- xml/Module.mk 74 additions, 0 deletionsxml/Module.mk
- xml/inc/LinkDef.h 24 additions, 0 deletionsxml/inc/LinkDef.h
- xml/inc/TXMLBuffer.h 295 additions, 0 deletionsxml/inc/TXMLBuffer.h
- xml/inc/TXMLDtdGenerator.h 77 additions, 0 deletionsxml/inc/TXMLDtdGenerator.h
- xml/inc/TXMLEngine.h 96 additions, 0 deletionsxml/inc/TXMLEngine.h
- xml/inc/TXMLFile.h 125 additions, 0 deletionsxml/inc/TXMLFile.h
- xml/inc/TXMLKey.h 76 additions, 0 deletionsxml/inc/TXMLKey.h
- xml/inc/TXMLSetup.h 121 additions, 0 deletionsxml/inc/TXMLSetup.h
- xml/src/TXMLBuffer.cxx 1939 additions, 0 deletionsxml/src/TXMLBuffer.cxx
- xml/src/TXMLDtdGenerator.cxx 602 additions, 0 deletionsxml/src/TXMLDtdGenerator.cxx
- xml/src/TXMLEngine.cxx 229 additions, 0 deletionsxml/src/TXMLEngine.cxx
- xml/src/TXMLFile.cxx 669 additions, 0 deletionsxml/src/TXMLFile.cxx
- xml/src/TXMLKey.cxx 162 additions, 0 deletionsxml/src/TXMLKey.cxx
- xml/src/TXMLSetup.cxx 183 additions, 0 deletionsxml/src/TXMLSetup.cxx
Loading
Please register or sign in to comment