[xsd-users] Extracting line number information from C++/Tree mapping objects

Boris Kolpackov boris at codesynthesis.com
Mon Jun 6 14:00:40 EDT 2011


Hi Jonathan,

Jonathan Cooper <c_xsdcxx at jonc.me.uk> writes:

> I'm having to do additional semantic validation on a document parsed  
> using C++/Tree, and would like to be able to report line & column number  
> from the original XML file. As far as I can tell, it seems like the only  
> way to do this is to maintain the DOM association and add user-data  
> containing the information to the DOM nodes during parsing, which seems  
> pretty evil especially using Xerces. Is there an easier way I'm  
> missing?

The other approach would be to customize the xml_schema::type class
(which is a base for all the generated classes) and add the line and
column information there.

> Has anyone done this already and can provide sample code?

There is an example that shows how to do this (see the README file inside
for details):

http://www.codesynthesis.com/~boris/tmp/linecol.tar.gz

Boris



More information about the xsd-users mailing list