Note that there are some explanatory texts on larger screens.

plurals
  1. POXML validation error when using multiple schema files/namespaces
    primarykey
    data
    text
    <p>I've been reading a ton about xml and learning a lot but I am stuck on one error.</p> <p>I have a schema defined in multiple files and I can't get it to work. Here is an example</p> <p>==================================</p> <h1>libraryBooks.xsd</h1> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:MyNamespace" targetNamespace="urn:MyNamespace" elementFormDefault="qualified" &gt; &lt;xsd:element name="libraryBooks" type="libraryBooksType"/&gt; &lt;xsd:complexType name="libraryBooksType"&gt; &lt;xsd:sequence&gt; &lt;xsd:any minOccurs="0"/&gt; &lt;/xsd:sequence&gt; &lt;xsd:attribute name="name" type="xsd:string"/&gt; &lt;/xsd:complexType&gt; &lt;/xsd:schema&gt; </code></pre> <p>==================================</p> <h1>book.xsd</h1> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:MyNamespace2" targetNamespace="urn:MyNamespace2" elementFormDefault="qualified" &gt; &lt;xsd:element name="book" type="booksType"/&gt; &lt;xsd:complexType name="bookType"&gt; &lt;xsd:attribute name="title" type="xsd:string"/&gt; &lt;/xsd:complexType&gt; &lt;/xsd:schema&gt; </code></pre> <p>==================================</p> <h1>myXml.xml</h1> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;libraryBooks xmlns="urn:MyNamespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:MyNamespace file:///C:/libraryBooks.xsd" name="CentralLibrary"&gt; &lt;mn2:book xmlns:mn2="file:///C:/book.xsd" title="How to make xml work the way I want"&gt; &lt;/mn2:book&gt; &lt;/libraryBooks&gt; </code></pre> <p>So the error I get would be "The 'file:///C:/book.xsd:book' element is not found". Any ideas? I'm almost certain it is something simple</p> <p><strong>Edit</strong>: Thank you so much everyone. I was close but just stuck on one minor thing. Really appreciate the direction. I tried both methods and in case anyone else reading this is wondering, the way to enter multiple schemaLocations at the root node is</p> <pre><code>xsi:schemaLocation="urn:MyNamespace file:///C:/libraryBooks.xsd urn:MyNamespace2 file:///C:/book.xsd" </code></pre>
    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.
 

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