xsd - Difference between using ID+IDREF and direct Type in XML Schema? -
i new xsd , have question difference between following 2 schemas?
1) direct use of idref , id limit selection element within file:
<xsd:element name="policy" > <xsd:complextype> <xsd:sequence> <xsd:element name="actor-def" type="tns:actor-def"/> <xsd:element name="actor-system-def" type="tns:actor-system-def"/> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:complextype name="actor-def"> <xsd:sequence> <xsd:element name="actor-system" type="tns:actor-system-type"/> </xsd:sequence> <xsd:attribute name="name" type="xsd:id" use="required" /> </xsd:complextype> <xsd:complextype name="actor-system-type"> <xsd:attribute name="name" type="xsd:idref" use="required" /> </xsd:complextype> <xsd:complextype name="actor-system-def"> <xsd:attribute name="name" type="xsd:id" use="required" /> <xsd:attribute name="url" type="xsd:anyuri" use="required" /> </xsd:complextype>
2) setting type of element directly other element type:
<xsd:element name="policy"> <xsd:complextype> <xsd:sequence> <xsd:element name="actor-def" type="tns:actor-def"/> <xsd:element name="actor-system-def" type="tns:actor-system-def"/> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:complextype name="actor-def"> <xsd:sequence> <xsd:element name="actor-system" type="tns:actor-system-def"/> </xsd:sequence> <xsd:attribute name="name" type="xsd:id" use="required" /> </xsd:complextype> <xsd:complextype name="actor-system-def"> <xsd:attribute name="name" type="xsd:id" use="required" /> <xsd:attribute name="url" type="xsd:anyuri" use="required" /> </xsd:complextype>
i faced issues using first approach when combining jaxb in translated java classes , suggested in response other post using second method. however, not sure main difference between these 2 schemas , 1 right 1 application?
Comments
Post a Comment