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

Jeroen N. Witmond [Bahco] jnw at xs4all.nl
Sun Jan 20 10:17:26 EST 2008


Hi Boris,

Boris Kolpackov <boris at codesynthesis.com> wrote:
> 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.

I assume you mean it is fixed afer 3.1.0.b1.

>> 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().

You are right, that is what I need, and my code was an ugly hack.

>> 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.

I've fixed this bug by making the following change in the generated code:
--- lax.cxx	2008-01-20 13:14:32.000000000 +0100
+++ lax.cpp	2008-01-20 16:01:42.000000000 +0100
@@ -400,18 +400,15 @@
     ::xsd::cxx::xml::dom::auto_ptr< ::xercesc::DOMDocument > d (
       ::xsd::cxx::xml::dom::parse< char > (u, h, p, f));

     h.throw_if_failed< ::xsd::cxx::tree::parsing< char > > ();

     ::std::auto_ptr< ::metadox::foo_type > r (
       ::metadox::foo (
-        d.get (), f | ::xml_schema::flags::own_dom, p));
-
-    if (f & ::xml_schema::flags::keep_dom)
-      d.release ();
+        d.release (), f | ::xml_schema::flags::own_dom, p));

     return r;
   }

   ::std::auto_ptr< ::metadox::foo_type >
   foo (const ::std::string& u,
        ::xml_schema::error_handler& h,

> Thanks for all the bug report!

You're welcome!

Jeroen.





More information about the xsd-users mailing list