Log of /trunk/io/xml/inc/TXMLEngine.h
Parent Directory
Revision
43515 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Mar 27 21:15:53 2012 UTC (2 years, 9 months ago) by
pcanal
File length: 6457 byte(s)
Diff to
previous 38266
Fix coding convention R.RN7 (Avoid the raw C types 'long', 'unsigned long', 'long double', 'bool', 'long long' and 'unsigned long long'.)
Revision
38266 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Mar 1 18:46:08 2011 UTC (3 years, 10 months ago) by
rdm
File length: 6453 byte(s)
Diff to
previous 36517
Add new optional parameter maxbuf to TXMLEngine::ParseFile() allowing
the specification of the XML file size to be parsed. This fixes issue #78864.
Revision
36517 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Nov 5 14:43:58 2010 UTC (4 years, 2 months ago) by
pcanal
File length: 6430 byte(s)
Diff to
previous 32188
Revert r31745 which resolved coverity reports by moving struct from C to C++ but was actually very costly in memory(71% more)
Revision
16434 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Oct 5 10:28:49 2006 UTC (8 years, 3 months ago) by
brun
Original Path:
trunk/xml/inc/TXMLEngine.h
File length: 6343 byte(s)
Diff to
previous 15512
From Sergey Linev:
1. TXMLEngine class (ROOT xml parser) in addition to normal xml nodes now can parse
xml processing instructions http://www.w3.org/TR/1998/REC-xml-19980210#sec-pi with syntax
<?something attr="value" attr2="value2" ... ?>
and xml comments http://www.w3.org/TR/1998/REC-xml-19980210#sec-comments with syntax
<!-- my comment string -->
2. Comment line and style sheet definition (one special case of xml processing instruction)
can be inserted manually by user with any text/xml editor or with new methods of TXMLFile
Bool_t TXMLFile::AddXmlComment(const char* comment);
Bool_t TXMLFile::AddXmlStyleSheet(const char* href, const char* type, ...);
3. Arbitrary text line can be inserted on the top of xml file with call:
Bool_t TXMLFile::AddXmlLine(const char* line);
Now this line can contain either comments or xml processing instruction, while
anything else will not pass xml syntax check.
Revision
15512 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 22 08:21:23 2006 UTC (8 years, 7 months ago) by
brun
Original Path:
trunk/xml/inc/TXMLEngine.h
File length: 5121 byte(s)
Diff to
previous 15238
From Sergey Linev:
1. Implementation of TDirectory I/O for TSQLFile and TXMLFile
2. In TSQLFile identifier length is now controled.
Important for Oracle, where table or column name cannot be more than 32 symbols.
3. Adding usage of TSQLStatement class where possible.
4. Small performance improvment.
Revision
13871 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jan 20 01:12:13 2006 UTC (9 years ago) by
pcanal
Original Path:
trunk/xml/inc/TXMLEngine.h
File length: 4547 byte(s)
Diff to
previous 13291
From Sergei Linev:
1. Better support of TClonesArray.
Now TBufferXML all set bit, that member-wise streaming is not supported.
Therefore, objects in TClonesArray are stored in XML file in "normal" form
and you can see correctly them in xml.
2. Object conversion to/from XML
Some times ago I get a request to convert object directly to XML form without
file I/O. I implement four static methods in TBufferXML:
static TString ConvertToXML(TObject* obj, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
static TString ConvertToXML(void* obj, TClass* cl, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
static TObject* ConvertFromXML(const char* str, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
static void* ConvertFromXMLAny(const char* str, TClass** cl = 0, Bool_t GenericLayout = kFALSE, Bool_t UseNamespaces = kFALSE);
They convert object to/from string with XML nodes. Simplest code is look like:
TH1* h = new TH1I("name","title", 1000, 0, 1000);
TString s = TBufferXML::ConvertToXML(h);
cout << s << endl;
TObject* obj = TBufferXML::ConvertFromXML(s);
if (obj) obj->Draw();
3. More information stored in XML file.
I now store file creation/modification time, file UUID, file title, key title and creation time.
I also put TXMLFile version into file itself to support old format of XML file for case of TClonesArray.
4. Preparation for custom streamers support
I already put implementation of methods
virtual void ClassBegin(const TClass*, Version_t = -1);
virtual void ClassEnd(const TClass*);
virtual void ClassMember(const char* name, const char* typeName = 0, Int_t arrsize1 = -1, Int_t arrsize2 = -1);
into TBufferXML class to enable support for custom streamers.
They work the same way as I did for TBufferSQL2 class,
but to enable them, I need declaration of that functions in TBuffer class.
For TBuffer these functions does not required any implementation.
Revision
10835 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Dec 20 17:04:29 2004 UTC (10 years, 1 month ago) by
brun
Original Path:
trunk/xml/inc/TXMLEngine.h
File length: 3580 byte(s)
Diff to
previous 9341
From Sergei Linev:
I implemented my own xml parser, which is capable to read and write xml files,
produced by ROOT XML I/O.
A lot of xml features are skipped, therefore it is 2.5 times faster and 4.5
times smaller in memory compared to libxml2.
The new implementation is backward compatible.
Revision
9341 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jun 29 14:45:38 2004 UTC (10 years, 6 months ago) by
brun
Original Path:
trunk/xml/inc/TXMLEngine.h
File length: 3281 byte(s)
Diff to
previous 9315
From Sergey Linev:
I slightly modify xml package. I remove non used class TXMLDtdGenerator. I
plan to move it's code in TXMLPlayer class later, when all code generation
will be done. Do not forget to delete TXMLDtdGenerator.* files from
root/xml/inc, root/xml/src and root/include directory.
I fix problem for the case, when class inherits from STL class.
I also add some comments to new TXMLPlayer class.
Revision
8929 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri May 14 14:30:46 2004 UTC (10 years, 8 months ago) by
brun
Original Path:
trunk/xml/inc/TXMLEngine.h
File length: 3219 byte(s)
Diff to
previous 8865
From Sergey Linev
1. TXMLFile can be opened with "create", "recreate", "open", "new", "update"
options. Special string like "2xoo" can be specified to "recreate" xml file with
specific xml options (explained in TXMLSetup class).
Close() and ReOpen() methods are implemented.
2. Correct writing and reading of TStreamerInfo classes to xml file.
Before they were skiped them when reading.
This can be optional (default on) (first cross in "2xoo")
3. Any data, which are stored directly to TBuffer like TBuffer::WriteBuf,
will be stored as binary block of data and restored when reading from file
4. According to compression level of TFile:
==0: no any repetition counters in arrays;
>0: repetition counter in array, in future also for TClonesArray fields
>5: file created without space indentation and new lines
Binary data compressed by zip with the same compression level
5. Namespaces are introduced (optional - default off).
If on, any data member get prefix according to class name.
To test, create file option should be "2xox" (last cross set namespaces on).
Object will look like:
<TAttLine xmlns:TAttLine="http://root.cern.ch/root/htmldoc/TAttLine.html" version="1">
<TAttLine:fLineColor v="1"/>
<TAttLine:fLineStyle v="1"/>
<TAttLine:fLineWidth v="1"/>
</TAttLine>
Important for DTD (in future) and just for convenient viewing of xml file.
6. Generic layout of XML file is introduced again.
still have some problems how it looks (because reading is ok), which
should be solved later.
In list of options it is first number 3 "3xoo".
Number 2 is default for class specific layout.
I keep several numbers for some variants, which may come later.
7. gXML global pointer is removed. Now each instance of TXMLFile creates own
copy of TXMLEngine object.
8. TXMLBuffer parent always set to correpondent TXMLFile. Important for TRef
classes.
9. Comments for TXMLFile, TXMLBuffer, TXMLKey are created. Other in progress
10. Small changes according to recent changes in TDirectory and in TKey
classes for not TObject classes.
Revision
8860 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Added
Mon May 10 21:29:26 2004 UTC (10 years, 8 months ago) by
brun
Original Path:
trunk/xml/inc/TXMLEngine.h
File length: 3102 byte(s)
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.
This form allows you to request diffs between any two revisions of this file.
For each of the two "sides" of the diff,
enter a numeric revision.