[xsd-users] base64Binary default value segfaults on startup

mhoffm1060 at aol.com mhoffm1060 at aol.com
Wed Jan 24 18:33:25 EST 2007


The problem I'm having is when a default value is added to the optional attribute ( "problem" below ), the program crashes on startup.  However when I remove the default value, the program runs fine.  ( The schema is defined by another entity, so just removing it is not a solution for me ). 
 
It looks like the problem is that XMLPlatformUtils::Initialize() is not being called before XMLString::transcode().
 
Thanks,
Mark Hoffmann
 
platform:     linux
xsd version:  2.3.0
gcc version:  4.1.0
 
Here is a fragment of the schema:
 
<xs:simpleType name="bar">
    <xs:restriction base="xs:base64Binary">
        <xs:maxLength value="1024">
        <xs:minLength value="0">
    </xs:restriction>
</xs:simpleType>
...
<xs:attributeGroup name="foo">
    ...
    <xs:attribute name="problem" type="bar" use="optional" default=""/>
    ...
</xs:attributeGroup>
 
 
The generated code:
 
const foo::problem::type foo::problem::default_value_(
    ::std::basic_string< char > (""), 0, 0, 0 );
 
 
Stack trace:
transcode                     xercesc_2_7::XMLString
    no code.
 
transcode_to_xmlch<char>      xsd::cxx::xml
  xsd/cxx/xml/string.ixx line 64
    template<>
    inline XMLCh*
    transcode_to_xmlch( const std::basic_string<char>& s)
    {
->        return xercesc::XMLString::transcode (s.c_str ());
    }
 
string<char>
  xsd/cxx/xml/string.hxx line 49
    template <typename C>
    string (const std::basic_string<C>& s)
->      : s_ (transcode_to_xmlch<C> (s))
    {
    }
 
base64_binary
  xsd/cxx/tree/parsing.txx  line 673
    template <typename C, typename B>
    base64_binary<C, B>::
    base64_binary ( const std::basic_string<C>& s,
                    const xercesc::DOMElement* e,
                    flags f,
                    type* c)
        : B (s, e, f, c)
    {
->    decode (xml::string (s).c_str ());
    }
 
bar
    bar::
    bar (const ::std::basic_string< char >& s,
         const ::xercesc::DOMElement* e,
         ::xml_schema::flags f,
         ::xml_schema::type* c)
->  : ::xml_schema::base64_binary (s, e, f, c)
    {
    }
 
_static_initialization_and_destruction_...
    const foo::problem::type foo::problem::default_value_ (
->    ::std::basic_string< char > (""), 0, 0, 0);
________________________________________________________________________
Check out the new AOL.  Most comprehensive set of free safety and security tools, free access to millions of high-quality videos from across the web, free AOL Mail and more.



More information about the xsd-users mailing list