Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Extended types in xsd

frank
2011-12-15
2013-05-01
  • frank
    frank
    2011-12-15

    Hi all,

    In my xsd, there are certain types that extend a supertype and that can be used interchangeaby in lists. F.e. the type "rule" is a supertype. ValidationRule and PricingRUle extend this supertype and will be used in other structures of the document.

    When I create a configuration file from my xsd and open it to edit xml, I am able to add the supertype only. The extended types can not be added.

    Is this something that is possible to do with jaxe? And if so, what should I be doing to achieve this?

    Thank you very much in advance.

    Kind regards,
    Frank

    fyi: the xsd looks somthing like this:

    <xs:complexType name="ruleGroup">
        <xs:sequence>
          <xs:element name="rules" type="rule" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:complexType>

    <xs:complexType name="rule">
        <xs:sequence>
          <xs:element name="ruleName" type="xs:string" minOccurs="0"/>
        </xs:sequence>
      </xs:complexType>

    <xs:complexType name="priceRule">
        <xs:complexContent>
          <xs:extension base="rule">
            …
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>

     
  • Configuration file rules apply on XML elements, not types. You should be able to use an element based on an extended type. Here is an example in the W3C schema (XMLSchema.xsd): the "attribute" element is based on a type extending the "annotated" type, which contains the "annotation" element. Because of this, when you add an "attribute" element in an XML schema, you can add an "annotation" element inside.