Note that there are some explanatory texts on larger screens.

plurals
  1. POXSD syntax for XML attributes with namespace
    primarykey
    data
    text
    <p>I have an xml fragment for which I need to write XSD</p> <pre><code>&lt;root xmlns="http://xmlns.oracle.com/sca/1.0" xmlns:id="http://xmlns.oracle.com/id/1.0"&gt; &lt;service name="Book" id:number="465"/&gt; &lt;/root&gt; </code></pre> <p>The following XSD gives error while JAXB class generation.</p> <pre><code>&lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/sca/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:element name="root"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="service"&gt; &lt;xs:complexType&gt; &lt;xs:simpleContent&gt; &lt;xs:extension base="xs:string"&gt; &lt;xs:attribute type="xs:string" name="name"/&gt; &lt;xs:attribute ref="ns:number" xmlns:ns="http://xmlns.oracle.com/id/1.0"/&gt; &lt;/xs:extension&gt; &lt;/xs:simpleContent&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>Error is</p> <p>C:\Program Files\Java\jdk1.7.0_06\bin>xjc -p test C:\book.xsd parsing a schema... [ERROR] src-resolve.4.2: Error resolving component 'ns:number'. It was detected that 'ns:number' is in namespace 'http://xmlns.oracle.com/id/1.0', but component s from this namespace are not referenceable from schema document 'file:/C:/book. xsd'. If this is the incorrect namespace, perhaps the prefix of 'ns:number' need s to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/C:/book.xsd'. line 10 of file:/C:/book.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.
    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