[xsd-users] RE: Problem during compilation of generated files

De, Pradipta pde at seic.com
Mon Oct 24 09:49:50 EDT 2005


Hi Boris,
I am able to integrate the xsd tree codes library to great extent with
my application.

But, in case of serialization I am getting core.....

What I have done, I just parse the XML and without any modification
unparsing the same.

The driver code is like that:

// file      : xsd/examples/cxx/tree/library/driver.cxx
// author    : Boris Kolpackov <boris at codesynthesis.com>
// copyright : not copyrighted - public domain

#include <memory>   // std::auto_ptr
#include <iostream>

#include "xxx_output.hxx"

using std::cerr;
using std::endl;

int
main (int argc, char* argv[])
{
  if (argc != 2)
  {
    cerr << "usage: " << argv[0] << " library.xml" << endl;
    return 1;
  }
  using namespace xxxx;

  // Read in the file.
  //
  std::auto_ptr<class AMLOutput> l (amloutput (argv[1]));


  // Now we are going to modify in-memory representation and serialize
it
  // back to XML.
  //
  xml_schema::namespace_infomap map;

  map["lib"].name = "/home1/xxxx/pradipta/parser_1.4/output_unparse";
  map["lib"].schema = "xxxx_Online_Output.xsd";


  // Write it out.
  //
  amloutput (std::cout, *l, map);
   return 0;
}

========================================================================
====

The stack trace of the core is as follows:

where -h
current thread: t at 1
  [1] _lwp_kill(0x0, 0x6, 0x21b10, 0xff2d0a14, 0x0, 0x0), at 0xff31f82c
  [2] raise(0x6, 0x0, 0xffbff0f0, 0xc9f60, 0xc2da4, 0x35c), at
0xff2d0a1c
  [3] abort(0xc5c00, 0xc5c00, 0x98698, 0xc9f60, 0xc2da4, 0x98320), at
0xff2b6cd8
  [4] __Cimpl::ex_terminate(0x0, 0x0, 0xc5f40, 0x5e3b0, 0xc5f40, 0x1),
at 0x980b4
  [5] _ex_throw_body(0xc5f40, 0x0, 0x0, 0x1, 0x2a584, 0xc5f40), at
0x98940
=>[6] xsd::cxx::xml::dom::dom<char>(el = CLASS, ns = CLASS, map =
STRUCT), line 193 in "serialization.txx"
  [7] xsd::cxx::xml::dom::dom<char>(root_element = 0x9c63c "amloutput",
root_element_namespace = 0x9c646 "http://www.tcs.com/xxxx", map =
STRUCT), line 96 in "serialization.hxx"
  [8] xxxx::amloutput(s = CLASS, m = STRUCT), line 292 in
"xxx_output.cxx"
  [9] xxxx::amloutput(o = CLASS, s = CLASS, m = STRUCT, e = CLASS), line
345 in "xxx_output.cxx"
  [10] main(argc = 2, argv = 0xffbff764), line 105 in "xxx_driver.cpp"

========================================================================
====

The xsd is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by George Koshy
(SEI Investments) -->
<schema targetNamespace="http://www.tcs.com/xxxx"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xxxx="http://www.tcs.com
/xxxx" elementFormDefault="qualified"
attributeFormDefault="unqualified">
        <element name="amloutput" type="xxxx:AMLOutput"/>
        <complexType name="AMLOutput">
                <annotation>
                        <documentation>Start of watchlist output
data</documentation>
                </annotation>
                <sequence>
                        <element name="msgID" type="string"/>
                        <element name="eventID" type="int"/>
                        <element name="accountNo" type="string"/>
                        <element name="externalTransID" type="string"/>
                        <element name="xxxxTransID" type="string"/>
                </sequence>
        </complexType>
</schema>

========================================================================
====
The XML is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by George Koshy
(SEI Investments) -->
<!--Sample XML file generated by XML Spy v4.4 U
(http://www.xmlspy.com)-->
<amloutput xmlns="http://www.tcs.com/xxxx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http:/
/www.tcs.com/xxxx ./xxx_output.xsd">
        <msgID>String</msgID>
        <eventID>0</eventID>
        <accountNo>String</accountNo>
        <externalTransID>String</externalTransID>
        <xxxxTransID>String</xxxxTransID>
</amloutput>
========================================================================
====

I think that information will help you....

If possible please look into that.....

Thanks and Regards,
Pradipta De 
-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Friday, October 21, 2005 10:51 AM
To: De, Pradipta
Cc: xsd-users at codesynthesis.com
Subject: Re: Problem during compilation of generated files

Pradipta,

De, Pradipta <pde at seic.com> writes:

> I go through the code of element.hxx and I found the patch you put is
> the following:
>
>          // For Sun C++ 5.6.
>          //
>          struct dom_info_factory;
>          friend struct type::dom_info_factory;
>
> But, dom_info_factory is part of class type and dom_info and
> dom_info_element are also part of same class, so why we require to put
> friend there.

I think it's because Sun C++ 5.6 does not allow nested classes to
access private members of outer class. In 5.7 they changed this, see

http://developers.sun.com/prodtech/cc/documentation/ss10_docs/mr/READMEs
/c++.html#new

fourth bullet.

> The error was coming for dom_info and dom_info_element in case of
> create (of element). But, for another create (of attribute) it was
> working fine. Although, both dom_element_info and dom_attribute_info
> were in the same scope.

I think the compiler just stopped compilation at the first function.

hth,
-boris





More information about the xsd-users mailing list