Skip to content

xs:keyref not working #1094

@LordOfDragons

Description

@LordOfDragons

Take an XSD like this one here:

<xs:schema attributeFormDefault='unqualified' elementFormDefault='qualified' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
  <xs:complexType name='source'>
    <xs:attribute name='name' type='xs:string' use='required'/>
  </xs:complexType>

  <xs:complexType name='target'>
    <xs:choice minOccurs='0' maxOccurs='unbounded'>
      <xs:element name='reference' type='xs:string'/>
    </xs:choice>
  </xs:complexType>

  <xs:complexType name='root'>
    <xs:choice minOccurs='0' maxOccurs='unbounded'>
      <xs:element name='source' type='source'/>
      <xs:element name='target' type='target'/>
    </xs:choice>
  </xs:complexType>

  <xs:element name='root' type='root'>
    <xs:unique name='unique.source.name'>
      <xs:selector xpath='source'/>
      <xs:field xpath='@name'/>
    </xs:unique>
    <xs:keyref name='keyref.target.reference' refer='unique.source.name'>
      <xs:selector xpath='target'/>
      <xs:field xpath='reference'/>
    </xs:keyref>
  </xs:element>
</xs:schema>

with an XML like this:

<root>
  <source name='test1'/>
  <source name='test1'/>
  <target>
    <reference>test2</reference>
  </target>
</root>

The extension will recognize that "test1" is duplicate (xs:unique works) but it will neither recognize that "test2" does not refer to a known name nor does it propose names on completion inside the "reference" tag at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions