c++ xml parser

Rob Hasselbaum rob-IdUdaS/NwSyQrzRDRVclEQ at public.gmane.org
Fri Apr 22 12:52:36 EDT 2011


On Fri, Apr 22, 2011 at 12:23 PM, Mark Woodward <markw-FJ05HQ0HCKaWd6l5hS35sQ at public.gmane.org>wrote:

> There are lots of XML parsers, i.e. systems like expat work fine, that
> answers problem #1. The next problem is how do you represent the data in
> C++? How generic does it need to be? what attribute takes will you
> recognize? will a <tag value='abcedf'/> be sufficient? Or does it need
> to be <tag>abcdef</tag>? Can it be both? Where's your data type
> represented, in the tag or a type attribute?
>

The purpose of an XML parser/serializer is to help you transfer data between
an external XML document and your program's domain object model. So the
problem your describing is only a problem within the relatively narrow scope
of the code that does the marshalling and unmarshalling. It's not a great
idea to use the XML parser's objects (e.g. Node, Entity, Attribute, etc.) to
represent the data within your business logic because that couples your code
to the parser's API and the XML document format in a very pervasive way.




More information about the Discuss mailing list