Hi!
Is it possible to generate the java source objects by hierarchy?
 
Ex. I have an XML like:
 
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<root>
  <s>
    <rules begin="1">
    </rules>
  </s>
  <rules model="parse" />
<root>
 
 
Note: Observe the two 'rules'-elements which occurs in different places in the XML.
 
 
 
When I create the xsd it will look like:
 
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="root">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="s" minOccurs="0" maxOccurs="unbounded">
     <xs:complexType>
      <xs:sequence>
       <xs:element name="rules" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
         <xs:attribute name="begin" type="xs:string" use="required" />
        </xs:complexType>
       </xs:element>
      </xs:sequence>
     </xs:complexType>
    </xs:element>
    <xs:element name="rules" minOccurs="0" maxOccurs="1">
     <xs:complexType>
      <xs:attribute name="model" type="xs:string" use="required" />
     </xs:complexType>
    </xs:element>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
<xs:schema>
 
 
 
It's obvious that the two 'rules'-element are of different types and that just one of the are going to be generated (I have tried).
When I did use JAXB they were created in a hierarchy and were never in conflict with eachother.
 
     Ex. Like: (primer is the package)
          primer.Root
          primer.Root.S
          primer.Root.S.Rules
          primer.Root.Rules
 
Is it possible to generate the Java-objects like this with Castor?
 
Best Regard//
Stefan H Westlund
 
PS. The point is that I already has got the XML in this manner from a distant server, which I can't control. DS.

Reply via email to