A xml schema created by "Schemagen" of Ant task can customize any more ?

Posted by Take on Stack Overflow See other posts from Stack Overflow or by Take
Published on 2011-01-17T00:48:36Z Indexed on 2011/01/17 0:53 UTC
Read the original article Hit count: 187

Filed under:
|
|
|

Now, I have two Java classes like this.

public class HogeDomain {

    private User userDomain;

    public HogeDomain() {
    }

         and getter/setter..  
}

public class User {

    public User() {
    }

    private String id;
    private String password;
    private Date userDate;

    and getter/setter..
}

And then, I created a xml schema above for using "Schemagen" of an Ant task automatically.

It's this.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="hogeDomain">
    <xs:sequence>
     <xs:element name="userDomain" type="user" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="user">
    <xs:sequence>
      <xs:element name="id" type="xs:string" minOccurs="0"/>
      <xs:element name="password" type="xs:string" minOccurs="0"/>
      <xs:element name="userDate" type="xs:dateTime" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>

But I really want to create a xml schema like this to using JAXB marshalling or unmarshalling.

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <xs:complexType name="hogeDomain">
         <xs:sequence>
           <xs:element name="userDomain" type="user" minOccurs="0"/>
         </xs:sequence>
      </xs:complexType>

      <xs:element name="user">
         <xs:complexType>
           <xs:sequence>
              <xs:element name="id" type="xs:string" minOccurs="0"/>
              <xs:element name="password" type="xs:string" minOccurs="0"/>
              <xs:element name="userDate" type="xs:dateTime" minOccurs="0"/>
           </xs:sequence>
         </xs:complexType>
      </xs:element>
 </xs:schema>

How to create this xml schema for using a "Schemagen" Ant task ? I don't want to write a xml schema for hand-made.

And is there any solutions when if it can't ?

© Stack Overflow or respective owner

Related posts about ant

Related posts about xml-schema