Re: Element Substitution
Martin Honnen <[email protected]> Mon, 3 May 2021 09:36:24 +0200
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <[email protected]> |
Am 02.05.2021 um 23:35 schrieb Paul Mensonides:
> I am trying to wrap my head around the rules for element substitution in
> XML Schema, but I am running into some kind of namespace problem.
>
> [a.xsd]
> <?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:a="urn:a"
> targetNamespace="urn:a"
> elementFormDefault="qualified"
> vc:minVersion="1.1">
> <xs:complexType name="type">
> <xs:sequence>
> <xs:element ref="a:element"
> minOccurs="0" maxOccurs="unbounded"/>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="element" type="a:type"/>
> </xs:schema>
>
> [b.xsd]
> <?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:a="urn:a" xmlns:b="urn:b"
> targetNamespace="urn:b"
> elementFormDefault="qualified"
> vc:minVersion="1.1">
> <xs:import namespace="urn:a" schemaLocation="a.xsd"/>
> <xs:complexType name="type">
> <xs:complexContent>
> <xs:extension base="a:type"/>
> </xs:complexContent>
> </xs:complexType>
> <xs:element name="element" type="b:type"
> substitutionGroup="a:element"/>
> </xs:schema>
>
> [x.xml]
> <?xml version="1.1" encoding="UTF-8"?>
> <a:element
> xmlns:a="urn:a" xmlns:b="urn:b"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="urn:a a.xsd urn:b b.xsd">
> <b:element/>
> </a:element>
>
> In Saxon 9.9.1.5 (which is the latest I have access to from the command
> line), this works fine.
>
> However, in Saxon 9.9.1.7 (which is what my version of Oxygen is using),
> it fails:
>
> In content of element <a:element>: The content model does not allow
> element <Q{urn:b}element> to appear as the first child. The element is
> in namespace urn:b but it should be in namespace urn:a.
I have tried oXygen 23.1 with Saxon 9.9.1.7 but I don't get any
validation error, only a warning about a duplicate schema import.
Saxon 9.9.1.7 and 10.5 EE from the command line also validate successfully.
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help