Note that there are some explanatory texts on larger screens.

plurals
  1. POExtend an XML schema with custom elements
    primarykey
    data
    text
    <p>I'm trying to do the following:</p> <pre><code>&lt;myNamespace:foo&gt; &lt;myNamespace:bar&gt;hello&lt;/myNamespace:bar&gt; &lt;myNamespace:extended&gt; &lt;yourNamespace:anything&gt; .... &lt;/yourNamespace:anything&gt; &lt;/myNamespace:extended&gt; &lt;/myNamespace:foo&gt; </code></pre> <p>Essentially, I want to design a schema that will allow a particular element to be overridden with elements from another namespace.</p> <p>I've tried this:</p> <pre><code>&lt;!-- mySchema.xsd --&gt; &lt;schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/mySchema" xmlns:myNamespace="http://www.example.org/mySchema" elementFormDefault="qualified"&gt; &lt;complexType name="extendedType"&gt; &lt;sequence&gt; &lt;any/&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;element name="foo"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="bar" type="string"/&gt; &lt;element name="extended" type="myNamespace:extendedType"/&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; </code></pre> <p>.</p> <pre><code>&lt;!-- yourSchema.xsd --&gt; &lt;schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/yourSchema" xmlns:yourNamespace="http://www.example.org/yourSchema" xmlns:myNamespace="http://www.example.org/mySchema" elementFormDefault="qualified"&gt; &lt;import namespace="http://www.example.org/mySchema" schemaLocation="mySchema.xsd"/&gt; &lt;redefine schemaLocation="mySchema.xsd"&gt; &lt;complexType name="extendedType"&gt; &lt;complexContent&gt; &lt;extension base="myNamespace:extendedType"&gt; &lt;sequence&gt; &lt;element name="anything"&gt;&lt;/element&gt; &lt;/sequence&gt; &lt;/extension&gt; &lt;/complexContent&gt; &lt;/complexType&gt; &lt;/redefine&gt; &lt;/schema&gt; </code></pre> <p></p> <p>but when I try to create a new document from yourSchema.xsd, i get the following in eclipse: "No root element exists since the schema provided has no global elements". Shouldn't yourSchema.xsd inherit the root element from mySchema.xsd? </p>
    singulars
    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.
    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