Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are actually two different ways to compose XML Schema documents: <code>&lt;xs:import&gt;</code> and <code>&lt;xs:include&gt;</code>. xs:include is intended to be used when the namespace of the containing document is the same as the one being referenced, so it's not quite what you're looking for. xs:import is better for your situation when you need to reference all (or a subset) of elements in the referenced schema and they're in a different target namespace. There's a question here on the differences: <a href="https://stackoverflow.com/questions/2357943/whats-the-difference-between-xsdinclude-and-xsdimport">What&#39;s the difference between xsd:include and xsd:import?</a>. </p> <p>Anyway, back to this specific question. What you probably want is something like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xs:schema xmlns="http://example.com/namespace/for/ElementB" targetNamespace="http://example.com/namespace/for/ElementB" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:ea="http://example.com/namespace/for/ElementA"&gt; &lt;xs:import namespace="http://example.com/namespace/for/ElementA" schemaLocation="A.xsd" /&gt; &lt;xs:element name="ElementB"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="foo" type="xs:string" /&gt; &lt;xs:element name="bar" type="xs:string" /&gt; &lt;!-- This introduces a element named ElementA that uses the ComplexType ea:ElementA defined in A.xsd --&gt; &lt;xs:element name="ElementA" type="ea:ElementA" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>Though you'll need A.xsd to create a complex type for ElementA that you can use in B.xsd as shown.</p> <p>This arcticle has some good information/examples and includes a discussion of some of the different composability strategies: <a href="http://www.xfront.com/ZeroOneOrManyNamespaces.html" rel="noreferrer">http://www.xfront.com/ZeroOneOrManyNamespaces.html</a></p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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