pleonex / atom-autocomplete-xml

Autcomplete XML package for Atom editor.
https://atom.io/packages/autocomplete-xml
MIT License
13 stars 8 forks source link

Support for xsi:type #11

Open jgrodskiy-donlen opened 8 years ago

jgrodskiy-donlen commented 8 years ago

Support for xsi:type and extending types in xml

<xs:complexType name="Animal">
    <xs:sequence>
      <xs:element name="name" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="animalClass" type="xs:string" use="required"/>
  </xs:complexType>
<xs:complexType name="LandAnimal">
    <xs:complexContent>
        <xs:extension base="Animal">
            <xs:sequence>
                <xs:element name="diet" type="xs:string"/>
            </xs:sequence>
            <xs:attribute name="diet" type="xs:string"/>
        </xs:extension>
    </xs:complexContent>
  </xs:complexType>
pleonex commented 8 years ago

Your example is almost working. The diet tag is not detected because it's overwritten by the diet attribute since both have the same name. I will consider this as a bug and try to fix for the next version.

jgrodskiy-donlen commented 8 years ago

So in that example, inside of zoo I should be able to make an "animal" or a landAnimal and see the appropriate options in the auto complete. In other editors the way that is done is with the xsi:type. The tag has the base name, and the xsi:type specifies the specific version and based on the xsi type it knows if there are other properties. If you need a better example or more explanation let me know.

<animal animalClass="" xsi:type="LandAnimal"> </animal>

schema.zip