List Info

Thread: Raw parsing an XML file or via xmlReader?




Raw parsing an XML file or via xmlReader?
user name
2006-08-22 14:43:06
Hello,

Like in most of the programming tasks we do, we have a few
ways to
resolve a task, and my
question goes for parsing an XML file.

I see that I can parse and extract the required information
using a raw
interface as explained in
http:
//www.xmlsoft.org/tutorial/xmltutorial.pdf (or
http://www
.xmlsoft.org/tutorial/index.html) 

The same task can be done using the xmlReader API, which is
a little bit
more complicated but may be more powerful.

The scenario: 
- I need to read, parse, and then write an XML file that
contains my
tool configuration settings.
- The file contains sections that may be re-used when the
tool wants to
export/import partial settings.
- The file may reach a size of 200KBytes..

Questions: 
- Should I use raw parsing (as in the examples on the
tutorial) or use
xmlReader?
- When creating the file, should I use xmlWritter?

I'm new to this XML library, I got drown already with the
information in
http://xmlsoft.org, 
I'm sure that the answer is there, but I could not get it
easily. 
I guess more tutorials are required 

Thanks in advance

-- Ricky Marek.
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
Raw parsing an XML file or via xmlReader?
user name
2006-08-22 15:00:32
> Hello,

Hello Ricky,

[snip]
> - The file may reach a size of 200KBytes..
> 
> Questions: 
> - Should I use raw parsing (as in the examples on the 
> tutorial) or use xmlReader?
> - When creating the file, should I use xmlWritter?

If you don't need anything special, use "raw
parsing". It is simple and
the file size is no problem. I have made some tests here and
on a
today's machine, libxml2 parsed a 4MiB File in less than
5s.

Best regards
	Andreas
-- 
Andreas Tscharner                         
andreas.tscharnermetromec.ch
------------------------------------------------------------
------------
And the beast shall come forth surrounded by a roiling cloud
of
vengeance. The house of the unbelievers shall be razed and
they shall be
scorched to the earth. Their tags shall blink until the end
of days.
                                            -- The Book of
Mozilla 12:10

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
Raw parsing an XML file or via xmlReader?
user name
2006-08-22 15:14:03
Hi Ricky,

> The scenario:
> - I need to read, parse, and then write an XML file
that contains my
> tool configuration settings.
XMLReader is useful when you want configuration settings
read from a  
config.xml file to your own structures.
Creating XML from your structures towards a libxml tree can
be done  
using the tree API (or the writer)


> - The file contains sections that may be re-used when
the tool  
> wants to
> export/import partial settings.
Partial settings can be dumped by selecting the right node
(start  
point for your partial data) and write that part to a file.
(or memory)
> - The file may reach a size of 200KBytes..
Should not be too much of an issue (except when you are
doing things  
on very low memory based hardware)

> Questions:
> - Should I use raw parsing (as in the examples on the
tutorial) or use
> xmlReader?
I would suggest the xmlReader if you need these config
settings used  
in your software.
You can keep the configuration by using
xmlTextReaderCurrentDoc() to  
manipulate and store it at a later time by using the raw
tree API.

> - When creating the file, should I use xmlWritter?
See: http://xmlso
ft.org/examples/testWriter.c
I did not do anything with writer (yet) but it seems a nice
and easy  
way to create the configuration XML from scratch. As soon as
you have  
an existing configuration XML, the tree API might be more
useful.

Kind Regards,

Olger

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )