[xsd-users] bug (?) with choice of two sequences with same element
Eelko de Groot
efdegroot at corp.csnet.nl
Thu Jan 5 05:06:18 EST 2006
When a schema contains a choice of two sequences of elements and both
sequences contain the same element, the xsd tool produces two
classes/structs with the same name.
The following example illustrates this problem.
Is there a solution for this?
$ cat test.xsd
<?xml version="1.0" encoding="utf-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:t="test"
targetNamespace="test"
version="0.1" elementFormDefault="qualified">
<element name="Test" type="t:TestChoiceType"/>
<complexType name="TestChoiceType">
<choice>
<sequence>
<element name="ElementA" type="string"/>
<element name="ElementB" type="string" minOccurs="0"/>
</sequence>
<sequence>
<element name="ElementB" type="string"/>
</sequence>
</choice>
</complexType>
</schema>
$
$ xsd cxx-tree --generate-inline test.xsd
$ cat test.hxx
...
namespace test
{
class TestChoiceType : public ::xsd::cxx::tree::type
{
public:
...
// ElementB1
//
public:
struct _xsd_ElementB1
{
typedef ::xml_schema::string type_;
typedef ::xsd::cxx::tree::traits< type_ > traits_;
typedef ::xsd::cxx::tree::optional< type_ > container_;
};
public:
struct ElementB1
{
typedef _xsd_ElementB1::type_ type;
typedef _xsd_ElementB1::container_ container;
};
_xsd_ElementB1::container_ const&
ElementB1 () const;
_xsd_ElementB1::container_&
ElementB1 ();
void
ElementB1 (_xsd_ElementB1::type_ const&);
void
ElementB1 (_xsd_ElementB1::container_ const&);
void
ElementB1 (::std::auto_ptr< _xsd_ElementB1::type_ >);
// ElementB1
//
public:
struct _xsd_ElementB1
{
typedef ::xml_schema::string type_;
typedef ::xsd::cxx::tree::traits< type_ > traits_;
typedef ::xsd::cxx::tree::optional< type_ > container_;
};
public:
struct ElementB1
{
typedef _xsd_ElementB1::type_ type;
typedef _xsd_ElementB1::container_ container;
};
_xsd_ElementB1::container_ const&
ElementB1 () const;
_xsd_ElementB1::container_&
ElementB1 ();
void
ElementB1 (_xsd_ElementB1::type_ const&);
void
ElementB1 (_xsd_ElementB1::container_ const&);
void
ElementB1 (::std::auto_ptr< _xsd_ElementB1::type_ >);
// Constructors.
//
public:
TestChoiceType ();
...
More information about the xsd-users
mailing list