Note that there are some explanatory texts on larger screens.

plurals
  1. POIs this a bug in XSD implementation? Why doesn't this work?
    primarykey
    data
    text
    <p>I have one xsd file I'd rather not modify (Exceptions.xsd):</p> <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://me.com/Exceptions.xsd" targetNamespace="http://me.com/Exceptions.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified" &gt; &lt;xs:element name="Exception" type="ExceptionType" /&gt; &lt;xs:complexType name="ExceptionType"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Code" type="xs:string" minOccurs="0"/&gt; &lt;xs:element name="Message" type="xs:string"/&gt; &lt;xs:element name="TimeStamp" type="xs:dateTime"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; </code></pre> <p>I want to create a new element with an other name that implements that ExceptionType (ExceptionsExtensions.xsd - Alternative 1).</p> <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://me.com/Exceptions.xsd" targetNamespace="http://me.com/Exceptions.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= " http://me.com/Exceptions.xsd Exceptions.xsd " elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:element name="SpecificException" type="ExceptionType" /&gt; &lt;/xs:schema&gt; </code></pre> <p>I get the error message: Type '<a href="http://me.com/Exceptions.xsd:ExceptionType" rel="nofollow noreferrer">http://me.com/Exceptions.xsd:ExceptionType</a>' is not declared.</p> <p>However, if I would do this (ExceptionExtensions.xsd - Alternative 2):</p> <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://me.com/Exceptions.xsd" targetNamespace="http://me.com/Exceptions.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= " http://me.com/Exceptions.xsd Exceptions.xsd " elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:element name="SpecificException"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="innerException"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:any namespace="http://me.com/Exceptions.xsd" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; </code></pre> <p>I can validate</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;SpecificException xmlns="http://me.com/Exceptions.xsd"&gt; &lt;innerException&gt; &lt;Exception&gt; &lt;Code&gt;12&lt;/Code&gt; &lt;Message&gt;Message&lt;/Message&gt; &lt;TimeStamp&gt;2009-08-27T11:30:00&lt;/TimeStamp&gt; &lt;/Exception&gt; &lt;/innerException&gt; &lt;/SpecificException&gt; </code></pre> <p>So in Alternative 1 it CANNOT find the ExceptionType which is declared in Exceptions.xsd, but in Alternative 2 it CAN find the Exception-element which is declared in Exceptions.xsd.</p> <p>Why doesn't Alternative 1 work?</p> <p>Kind regards, Guillaume Hanique</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload