Extension in XMlSchema, how?

I wrote XMLSchema, which looks like below. The idea is that baseContainer only allows some tags, and fullContainer allows you to use all tags in baseContainer + some other tags. Tags can appear in any order and can be short of all tags. My real sample has a lot more tags, so this XMLSchema writing method tends to become big and unstructured. I want to use the XMLSchema extension tag to structure a document, but it does not work as I expect.

Thanks in advance:)

<complexType name="baseContainer">
  <sequence minOccurs="0" maxOccurs="unbounded">
    <choice minOccurs="0" maxOccurs="1">
      <element ref="w:aTag0"/>
      <element ref="w:aTag1"/>
      <element ref="w:aTag2"/>
    </choice>
  </sequence>
</complexType>

<complexType name="fullContainer">
  <sequence minOccurs="0" maxOccurs="unbounded">
    <choice minOccurs="0" maxOccurs="1">
      <element ref="w:aTag0"/>
      <element ref="w:aTag1"/>
      <element ref="w:aTag2"/>
      <element ref="w:aTag3"/>
      <element ref="w:aTag4"/>
    </choice>
  </sequence>
</complexType>

I tried this:

<complexType name="fullContainer">
  <complexContent>
    <extension base="w:baseContainer">
      <sequence minOccurs="0" maxOccurs="unbounded">
        <choice minOccurs="0" maxOccurs="1">
          <element ref="w:aTag3"/>
          <element ref="w:aTag4"/>
        </choice>
      </sequence>
    </extension>
  </complexContent>
</complexType>
+3
source share
1 answer

, , , xml-. ( ) . .

0

Source: https://habr.com/ru/post/1733079/


All Articles