日期:2014-05-20  浏览次数:20605 次

castor的使用
XML code


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"> 
        <xs:element name="persons">
        <xs:complexType>
            <xs:sequence> 
                <xs:element maxOccurs="unbounded" minOccurs="0" ref="person"/> 
            </xs:sequence>
        </xs:complexType>
    </xs:element> 
    <xs:element name="Address">
        <xs:complexType>
            <xs:sequence> 
                <xs:element minOccurs="0" name="code"/> 
            </xs:sequence> 
        </xs:complexType>
    </xs:element>
    <xs:element name="person">
        <xs:complexType>
            <xs:sequence> 
                <xs:element minOccurs="0" ref="name"/> 
            </xs:sequence>
            <xs:attribute name="id" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>
    <xs:element name="name" type="xs:string"/> 
</xs:schema>






生成类:Address.java public class Address implements java.io.Serializable
  Person.java public class Person implements java.io.Serializable

想要的结果是: 
Address.java public class Address implements java.io.Serializable
public class Person extends Address implements java.io.Serializable

------解决方案--------------------
呵呵 人家都没满意吧! 那就给我分吧