redhat-developer / redhat-developer/vscode-xml

XSD 1.1 - cannot validate with conditions

Open
#783 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
328
Forks
101
Avg merge
1d 17h
Merged PRs (30d)
7

Description

Hello, I'm trying to use conditions in my XSD, because of different tags in elements.

<xs:element name="a" maxOccurs="unbounded">
<xs:alternative test="@type = 1" type="a1Type"/>
<xs:alternative test="@type = 1" type="a2Type"/>
</xs:element>
<xs:complexType name="a1Type">
<xs:sequence>
<xs:element name="name" />
<xs:element name="surname" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="a2Type">
<xs:sequence>
<xs:element name="name" />
<xs:element name="id" />
</xs:sequence>
</xs:complexType>

When i will drop that to W3C validator, it's valid. But in VS code with your extension not. It says this: s4s-elt-must-match.1: The content of 'a' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: alternative.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by loading the supplied XSD 1.1 sample in the VS Code XML extension and compare its diagnostics with the W3C validator. Trace the extension's schema-validation entry point for xs:alternative and make the valid XSD 1.1 content pass without the s4s-elt-must-match.1 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.