[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML parsing memory overhead concerns

  • From: Paul Miller <stele@f...>
  • To: "Clark C. Evans" <clark.evans@m...>, James Clark <jjc@j...>, xml-dev <xml-dev@i...>
  • Date: Sat, 18 Dec 1999 08:02:36 -0500

memory overhead
> When I get to the handler, I'd like to write this:
> 
> void PointHandler(XML::Element &elem, Point *point)
> {
>         // "pull" a chunk of element data, but it'll automatically
>         // stop when it gets to the end of the element (it stops
>         // when it sees </Point>)
>         char buf[40];
>         elem.GetData(buf, sizeof(buf));
>         sscanf(buf, "%dx%d", &point->x, &point->y);
> }
> 
> For some reason I couldn't figure out how to make this work, because
> with expat I might have hit the element but not necessary gotten to the
> character data handler.

I remembered why I couldn't get this part to work. Suppose (using expat)
I get to the <Point> element. So far I can build the tree down to this
point, so when I see <Point> I look in the handler list for that subtree
and call the callback for the Point element. Now in PointHandler, the
code wants to pull the element data. I can't go back into expat and
parse some more at this point, getting called back with expat's
CharacterData handler, fill my buffer, and fall back out to
PointHandler.

But this brings up a question: does expat buffer the entire character
data itself? If it does, perhaps I could delay the call to PointHandler
until after the expat character data handler has been called. I can save
a copy of that pointer away in my Element list, and only call the user
code when I see the end element tag.

Does this sound workable?

--
Paul Miller - stele@f...

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.