[Expat-discuss] XML Parse into Structure

Nick MacDonald nickmacd at gmail.com
Fri Jun 4 20:13:32 CEST 2010


Vijay:

If you want an "in memory" representation of your XML file, you
probably don't want or need to use a SAX based parser like eXpat which
is event based.  You'd probably rather find a DOM based parser which
is expressly designed to build a Document Object Model (the DOM in the
name) in memory.  You could of course layer a DOM module on top of
eXpat, but I suspect that's a fair amount of work that has already
been done many times before, if you do some searching on Source Force
and other open source repositories I'm sure you'll find a lot of
examples.  The whole idea to use SAX is to be able to process a
document with minimal memory overhead... and thus to be able to handle
exceptionally large documents that would use too much memory if they
were loaded into memory all at once.  (And SAX would be faster if you
were just searching quickly inside a document... no overhead loading
into memory that parts you'd never use.)

Good luck,
  Nick

On Thu, Jun 3, 2010 at 8:51 AM, Vijay Nikam <vijay.t.nikam at gmail.com> wrote:
> I am new to the XML parsing and list.
> Just couple of days before I started to work on Expat parser.
> I am parsing the XML files in C (libexpat.so - Linux) and I tried to
> parse the XML file using expat parser
> and was successful. So it was great start. thanks to the information
> provided on the following link:
>    http://www.xml.com/pub/a/1999/09/expat/index.html#useparser
>
> The output of the XML parsed file is dumped on the console. Based on
> this I have two queries:
> 1. Is it possible to dumped the parsed file into the text file? If yes
> then please let me know (any pointers/ideas), thanks.
> 2. Is it possible to create structure with expat parser from XML file?
>    - Is there any funtion available to achieve this in C, like, there
> is function available for PHP XML Expat Parser
> (xml_parse_into_struct)?
>
> Please let me know any pointers regarding above two mentioned queries?
> Any provided information will be imporatant and helpful.
> So Kindly please acknowledge, thank you.

-- 
Nick MacDonald
NickMacD at gmail.com


More information about the Expat-discuss mailing list