Hi, castor.

I'm new for castor. I want to ask you about odd behavior. My problem
is marshalled XML document seems invalid. An element change an attribute.

For example:

1. I defined following XML Schema(test.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="root">
    <xsd:complexType>
      <xsd:sequence>

        <xsd:element name="id" type="xsd:integer"/>

        <xsd:element name="nest">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="aaa" type="xsd:string"/>
              <xsd:element name="bbb" type="xsd:string"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>

      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>


2. I generated XML Binding Class by following command:

$ java org.exolab.castor.builder.SourceGenerator -nodesc -i test.xsd


3. Generate XML File by following code:

  Root root = ...
  Marshaller.marshal(root, new FileWriter("out.xml"));


4. Then I obtained following XML:
<?xml version="1.0" encoding="UTF-8"?>
<root valid="true" id="1"><nest
valid="true"><bbb>str1</bbb><aaa>str1</aaa></nest></root>



So, 'id' is an _element_ in test.xsd, however 'id' in generated XML is an
_attribute_. How could I treat id as an element at output XML?

thanks,

Takashi Okamoto

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to