[xsd-users] cxx-parser: Not all attributes in the XML namespace are typemapped.

Boris Kolpackov boris at codesynthesis.com
Sun Jan 20 05:12:52 EST 2008


Hi Jeroen,

Jeroen N. Witmond [Bahco] <jnw at xs4all.nl> writes:

> All this also resulted in a number of questions and comments:
>
> 1. The generated test driver for parser-datamodel contains, under '//
> Instantiate individual parsers.', the declaration
> '::xml_schema::ncname_pimpl ncname_p;'. This variable ncname_p is never
> used.

This is a bug and it is now fixed for 3.1.0.


> 2. It would be nice if cxx-parser supported the --generate-xml-schema and
> --extern-xml-schema like cxx-tree.

I've added this to my TODO list though it probably won't be implemented
for 3.1.0.


> 3. In the handler for xml:id, I throw an exception when the value of the
> attribute has been seen before. Is there a way to include information
> about the source location in the xml file in this exception?

There is no easy way to get this information at the moment. However,
we are planning to change the underlying C++/Parser architecture which
would also allow accessing the underlying XML parser from parser
implementations which in turn would allow you to query line/column
information. This change is not planned for 3.1.0 though.

The "hard" way that will work right now is to set the SAX parser
yourself and route the low-level parsing events to the document
object (see libxsd/xsd/cxx/parser/document.hxx). When an exception
is thrown by one of the parser implementations, you can catch it
at the point where you set up the SAX parser, query the line/column
information, add it to the exception, and re-throw.


> 4. To handle the inheritance for an element, I need access to the parent
> of that element. At the moment, I use an ugly hack for this, see file
> custom-datamodel/XmlNamespace.cpp[4], starting at line 146. Is there a
> better way to do this?

I am having a hard time following your code, but if I understood you
correctly, you need to get hold of a object model node that contains
this instance. If that's the case then you can use _me->_container().


> 5. When I throw an exception in the setter for xml:id (called from the
> constructor of the custom type), the program terminates with
>    pure virtual method called
>    terminate called without an active exception
> Debugging with Valgrind[4] shows that the DOMDocument is reset twice.

This appears to be a bug. I've added it to my TODO list.


> 6. As in the case of cxx-parser, it would be nice if I could report the
> source location in the xml file also with cxx-tree.

Please see this thread for more information on how to do this:

http://www.codesynthesis.com/pipermail/xsd-users/2007-June/001080.html


Thanks for all the bug report!

Boris




More information about the xsd-users mailing list