[xsd-users] [C++/Parser] Passing arguments to the document parser

Boris Kolpackov boris at codesynthesis.com
Mon Mar 7 08:37:15 EST 2011


Hi Alessandro,

Alessandro Carpi <alessandro.carpi at gmail.com> writes:

> I am using C++/Parser and I have a simple question: is there a way to pass a
> specific argument to the document parser, it will be visible from my
> callbacks ?

No, but you can pass anything you want to the parser implementation's
constructors.


> I have a data structure that is filled outside the code implementing my
> parser, but I need to use such structure in order to verify if informations
> read from the XML are consistent with what I should expect.
> 
> For instance, such data structure contains a list of possibile names. When
> an attribute "name" was parsed I must check if the value is present into
> this names' list.

You could pass/store a reference to this data structure in the parser
implementation that handles the "name" attribute. This way you can change
the list of names between the parse sessions if you would like to reuse
the same set of parsers to parse multiple documents.

Boris



More information about the xsd-users mailing list