xs:alternative Content Completion
Posted: Sat May 01, 2021 8:47 am
Years ago, the editor supplied content completion based on the type selected via an xs:alternative. It stopped doing so when I upgraded from 15/16 to 21/23.
E.g. given this schema:
The editor will not give content completion assistance for the attributes "left" or "right" depending on "condition."
Similarly, if the derived types in the schema have child elements (etc.), no content completion assistance comes up for them either.
This is causing a bloat of xsi:type attributes in the instance documents. What happened?
E.g. given this schema:
Code: Select all
<?xml version="1.1" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns="urn:test" targetNamespace="urn:test" elementFormDefault="qualified"
vc:minVersion="1.1">
<xs:complexType name="base">
<xs:attribute name="condition" type="xs:boolean" use="required"/>
</xs:complexType>
<xs:complexType name="derived-1">
<xs:complexContent>
<xs:extension base="base">
<xs:attribute name="left"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="derived-2">
<xs:complexContent>
<xs:extension base="base">
<xs:attribute name="right"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="element" type="base">
<xs:alternative test="data(@condition) = ('true', 1)" type="derived-1"/>
<xs:alternative test="data(@condition) = ('false', 0)" type="derived-2"/>
</xs:element>
</xs:schema>
Code: Select all
<?xml version="1.1" encoding="UTF-8"?>
<element
xmlns="urn:test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:test test.xsd"
condition="true"/>
This is causing a bloat of xsi:type attributes in the instance documents. What happened?