Possibility of XML I/O support in ROOT

Slides:



Advertisements
Similar presentations
EIONET Training Zope Page Templates Miruna Bădescu Finsiel Romania Copenhagen, 28 October 2003.
Advertisements

W3C XML Schema: what you might not know (and might or might not like!) Noah Mendelsohn Distinguished Engineer IBM Corp. October 10, 2002.
An Introduction to XML Based on the W3C XML Recommendations.
XML Parsing Using Java APIs AIP Independence project Fall 2010.
1 COS 425: Database and Information Management Systems XML and information exchange.
XML Introduction What is XML –XML is the eXtensible Markup Language –Became a W3C Recommendation in 1998 –Tag-based syntax, like HTML –You get to make.
XML October 24, Unit 6. What is XML? Stands for eXtensible Markup Language It is a markup language, like HTML But, –XML is designed to markup data –HTML.
Introduction to XML This material is based heavily on the tutorial by the same name at
XML I/O in ROOT S. Linev, R. Brun, H.G. Essel CHEP 2004.
Status of SQL and XML I/O Sergey Linev, GSI, Darmstadt, Germany.
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
CREATED BY ChanoknanChinnanon PanissaraUsanachote
Games Development 2 Text-based Game Data CO3301 Week 4.
1 XML as a preservation strategy Experiences with the DiVA document format Eva Müller, Uwe Klosa Electronic Publishing Centre Uppsala University Library,
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
THttpServer class Sergey Linev (GSI). Some history Development was inspired by JSRootIO why not achieve similar functionality with online ROOT application?
PCWG Analysis Tool Peter Stuart September 15, 2015.
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
XML TUTORIAL Portions from w3 schools By Dr. John Abraham.
Java Root IO Part of the FreeHEP Java Library Tony Johnson Mark Dönszelmann
© GMV S.A., 2004 Property of GMV S.A. All rights reserved 2004/05/13 XML in CCSDS CCSDS Spring Meeting - Montreal Fran Martínez GMVSA 4081/04.
Accessing Data Using XML CHAPTER NINE Matakuliah: T0063 – Pemrograman Visual Tahun: 2009.
THttpServer for ROOT Bertrand Bellenot, CERN Sergey Linev, GSI Darmstadt
ROOT I/O for SQL databases Sergey Linev, GSI, Germany.
XML Refresher Course Bálint Joó School of Physics University of Edinburgh May 02, 2003.
CHEP /21/03 Detector Description Framework in LHCb Sébastien Ponce CERN.
Using of XML for object store S. Linev, GSI Using of XML for object store. S.Linev2 Content XML and existing packages XML and existing packages.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
1 “Universal Data-Speak”: The eXtensible Markup Language Zack Ives CSE 590DB, Winter 2000 University of Washington 3 January 2000.
ROOT Tutorials - Session 51 ROOT Tutorials – Session 5 Dictionary Generation, rootcint, Simple I/O, Hands-on Fons Rademakers.
STAR Schema Evolution Implementation in ROOT I/O V. Perevoztchikov Brookhaven National Laboratory,USA.
CHEP /21/03 Detector Description Framework in LHCb Sébastien Ponce CERN.
ROOT I/O in JavaScript Browsing ROOT Files on the Web For more information see: For any questions please use following address:
XML CSC1310 Fall HTML (TIM BERNERS-LEE) HyperText Markup Language  HTML (HyperText Markup Language): December  Markup  Markup is a symbol.
Martin Kruliš by Martin Kruliš (v1.1)1.
©2001 Priority Technologies, Inc. All Rights Reserved Meteor Status Miami Face to Face Meeting January 16 – 18, 2002.
Introduction to XML Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Go4 Workshop J.Adamczewski-Musch, S.Linev Go4 advanced features.
CHAPTER NINE Accessing Data Using XML. McGraw Hill/Irwin ©2002 by The McGraw-Hill Companies, Inc. All rights reserved Introduction The eXtensible.
AliRoot Classes for access to Calibration and Alignment objects Magali Gruwé CERN PH/AIP ALICE Offline Meeting February 17 th 2005 To be presented to detector.
XML Extensible Markup Language
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
XML Databases Presented By: Pardeep MT15042 Anurag Goel MT15006.
1 Introduction to XML Babak Esfandiari. 2 What is XML? introduced by W3C in 98 Stands for eXtensible Markup Language it is more general than HTML, but.
*DT Project Model Leo Treggiari Intel Corp. Dec, 2005.
Why Learn Android? Largest installation base of any operating system Over 20,000 Android devices exist Businesses will likely move more to device-based.
1 XML and XML in DLESE Katy Ginger November 2003.
XML BASICS and more…. What is XML? In common:  XML is a standard, simple, self-describing way of encoding both text and data so that content can be processed.
Product Training Program
XML Parsers Overview Types of parsers Using XML parsers SAX DOM
Unit 4 Representing Web Data: XML
XML Schema for WIRED XML Detector Description Workshop
News on the CDB Framework
XML in Web Technologies
Eugenia Fernandez IUPUI
3D graphics in JavaScript ROOT
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
Database Processing with XML
Lecture 9 Concepts of Programming Languages
XML Parsers Overview Types of parsers Using XML parsers SAX DOM
XML Data Introduction, Well-formed XML.
Automated support of STL containers
Presented by: Jacky Ma Date: 11 Dec 2001
S.Linev, J. Adamczewski, M. Al-Turany, D. Bertini, H.G.Essel
What is XML?.
Zooming on ROOT files and Containers
CSE591: Data Mining by H. Liu
Working with HADES WebDB HADES analysis workshop, Darmstadt, Germany, 31 January - 1 February 2012 Ilse Koenig, GSI Darmstadt Outline: Version management.
Games Development 2 Text-based Game Data
Lecture 9 Concepts of Programming Languages
Presentation transcript:

Possibility of XML I/O support in ROOT S. Linev, GSI, Darmstadt ROOT Workshop 2004

XML I/O in ROOT. S.Linev, GSI Content XML and existing packages Concept of XML I/O for ROOT Possible implementations Problems and questions Conclusion 25.2.2004 XML I/O in ROOT. S.Linev, GSI

eXtensible Markup Language (XML) Tree like structure (not ROOT tree) of text tags Each tag opened should be closed Tag can include other tags, contain text, has attributes In addition: DTD, XSLT, XML schema, namespaces, … <?xml version="1.0"?> <Example> <item1>item text</item1> <item2 id="001"> <subitem>subitem text</subitem> </item2> <item3 ref="001"/> </Example> Example values: item1 “item text“ item2 id="001" subitem “subitem text“ item3 ref="001" 25.2.2004 XML I/O in ROOT. S.Linev, GSI

XML I/O in ROOT. S.Linev, GSI XML packages C/C++ based XML packages: libxml (Gnome) http://xmlsoft.org Xerces-C++ (Apache) http://xml.apache.org/xerces-C/ expat (Mozilla) http://expat.sourceforge.net Benchmarks of XML packages: http://xmlbench.sourceforge.net 25.2.2004 XML I/O in ROOT. S.Linev, GSI

Usage of libxml2 library Example of code to create XML file: xmlDocPtr fDoc = xmlNewDoc(0); xmlNodePtr fNode = xmlNewDocNode(fDoc, 0, (const xmlChar*) "Example", 0); xmlDocSetRootElement(fDoc, fNode); xmlNewTextChild(fNode, 0, (const xmlChar*) "item1",(const xmlChar*) "item text"); xmlNodePtr sub2 = xmlAddChild(fNode, xmlNewNode(0, (const xmlChar*) "item2")); xmlNewTextChild(sub2, 0, (const xmlChar*) "subitem", (const xmlChar*) "subitem text"); xmlNewProp(sub2, (const xmlChar*) "id", (const xmlChar*) "001"); xmlNodePtr sub3 = xmlAddChild(fNode, xmlNewNode(0, (const xmlChar*) "item3")); xmlNewProp(sub3, (const xmlChar*) "ref", (const xmlChar*) "001"); xmlSaveFormatFile("Example.xml", fDoc, 1); xmlFreeDoc(fDoc); 25.2.2004 XML I/O in ROOT. S.Linev, GSI

XML I/O in ROOT. S.Linev, GSI XML and ROOT XML as metadata storage place: configuration, parameters and geometry objects XML files can be viewed and edited (with some restriction) with standard XML tools Data exchange between different packages But currently: There is no XML support in ROOT (yet) Each new class requires its own XML streamer 25.2.2004 XML I/O in ROOT. S.Linev, GSI

XML I/O in ROOT. S.Linev, GSI Motivation ROOT has all class information in TStreamerInfo class with methods to serialize/deserialize objects Why not implement similar mechanism for XML, not only for binary ROOT format? Aim – introduce XML I/O in ROOT, where user should not write I/O code himself 25.2.2004 XML I/O in ROOT. S.Linev, GSI

Object representation in XML object id class TXmlExample { public: Int_t fValue; Double_t fArray[5]; TString fStr; TXmlExample* fSelfPtr; ClassDef(TXmlExample, 1); }; class name <TXmlExample ref="id0"> <fValue v="10"/> <fArray> <Double v="1.0"/> <Double v="10.0"/> <Double v="5.0"/> <Double v="7.0"/> <Double v="2.0"/> </fArray> <fStr TString="Hello"/> <fSelfPtr ptr="id0"/> </TXmlExample> basic type array string (special case) pointer 25.2.2004 XML I/O in ROOT. S.Linev, GSI

XML I/O in ROOT. S.Linev, GSI First Implementation New class with two functions similar to TStreamerInfo::WriteBuffer() and TStreamerInfo::ReadBuffer() were implemented to serialize/deserialize objects to/from XML structures Libxml2 library was used Requires no any ROOT modifications 25.2.2004 XML I/O in ROOT. S.Linev, GSI

XML I/O in ROOT. S.Linev, GSI Problems Only relatively “simple” objects can be stored Custom streamers are not supported As a result, ROOT classes like histograms (TH1), containers (TObjArray) and many other can not be supported 25.2.2004 XML I/O in ROOT. S.Linev, GSI

TBuffer class modification Make six methods of TBuffer virtual: void WriteObject(const void *actualObjStart, TClass *actualClass); void* ReadObjectAny(const TClass* cast); Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss); void SetByteCount(UInt_t cntpos, Bool_t packInVersion = kFALSE); Version_t ReadVersion(UInt_t *start = 0, UInt_t *bcnt = 0); UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt = kFALSE); Redefine these methods in new TXmlBuffer class to perform XML specific actions To support “TFile-like” key organization, new TXmlFile and TXmlKey classes have been created 25.2.2004 XML I/O in ROOT. S.Linev, GSI

Example with TObjArray <?xml version="1.0"?> <root> <XmlKey name="array" setup="1xxox"> <TObjArray version="3"> <XmlObject> <TNamed> <fName TString="name1"/> <fTitle TString="title1"/> </TNamed> </XmlObject> <fName TString="name2"/> <fTitle TString="title2"/> <fName TString="name3"/> <fTitle TString="title3"/> <XmlBlock size="9"> 00 00 00 00 03 00 00 00 00 </XmlBlock> </TObjArray> <XmlClasses> <TNamed version="1"/> </XmlClasses> </XmlKey> </root> <?xml version="1.0"?> <root> <XmlKey name="array" setup="1xxox"> <TObjArray version="3"> <UChar>0</UChar> <Int>3</Int> <Int>0</Int> <XmlObject> <TNamed> <fName TString="name1"/> <fTitle TString="title1"/> </TNamed> </XmlObject> <fName TString="name2"/> <fTitle TString="title2"/> <fName TString="name3"/> <fTitle TString="title3"/> </TObjArray> <XmlClasses> <TNamed version="1"/> </XmlClasses> </XmlKey> </root> XmlKey with name and setup info TObjArray tag with version TObjArray arr; arr.Add(new TNamed("name1", "title1")); arr.Add(new TNamed("name2", "title2")); arr.Add(new TNamed("name3", "title3")); TXmlFile file("test.xml","1xxox"); file.Write(&arr, "array"); Part of TObjArray streamer (writing): … fName.Streamer(b); nobjects = GetAbsLast()+1; b << nobjects; b << fLowerBound; Now only version, later full class info 25.2.2004 XML I/O in ROOT. S.Linev, GSI

Consequence of TBuffer modification Most of ROOT classes can be stored Users classes with custom streamers can be supported Works, if reading and writing parts of custom streamer have similar sequence of I/O actions (normal situation) Some classes like TTree & TClonesArray are not tested and may be not required to be stored in XML format At worse case 10% lost of I/O performance Still not fully acceptable because: this is just “hacking” of ROOT code TXmlFile and TXmlKey repeats a lot of functionality of similar TFile and TKey classes 25.2.2004 XML I/O in ROOT. S.Linev, GSI

Further investigations Producing of DTD files for validation purposes Using of XML namespaces to avoid names intersection Extension of TFile and TKey logic on XML files (via abstract interfaces) C++ code generator for XML I/O to access ROOT objects outside a ROOT environment Support of different XML packages 25.2.2004 XML I/O in ROOT. S.Linev, GSI

XML I/O in ROOT. S.Linev, GSI Conclusion There is no general XML I/O in ROOT Very limited solution possible without ROOT changing With slight TBuffer modifications acceptable XML support in ROOT is possible Further investigations required 25.2.2004 XML I/O in ROOT. S.Linev, GSI