You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Keefer, Robert (LNG)" <ro...@lexisnexis.com> on 2002/01/17 17:13:58 UTC

SOAP Schema validation

Hi all,

What follows is a schema and an instance document that validates
using xsv (http://www.ltg.ed.ac.uk/~ht/xsv-status.html), but does not
validate using Xerces-J 1.4.3 or 1.4.4. The error reported from Xerces is 

[Error] Foo.xml:8:49: Schema error: prefix xs not bound to namespace URI.


Thoughts?

- Rob



-------------------  SCHEMA (Foo.xsd) -----------------------

<?xml version="1.0"?>
<xsd:schema targetNamespace="http://www.bar.com/soap1_1/"
                  xmlns:tns="http://www.bar.com/soap1_1/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:SOAP-ENC="http://www.w3.org/2001/09/soap-encoding"
                  elementFormDefault = "qualified">

  <xsd:import schemaLocation="http://www.w3.org/2001/XMLSchema.xsd"
              namespace="http://www.w3.org/2001/XMLSchema"/>

  <xsd:import schemaLocation="http://www.w3.org/2001/09/soap-encoding"
              namespace="http://www.w3.org/2001/09/soap-encoding"/>

  <xsd:element name="SnigletList" type="tns:SnigletList"/>

  <xsd:complexType name="SnigletList">
    <xsd:complexContent>
      <xsd:restriction base="SOAP-ENC:Array">
        <xsd:sequence>
          <xsd:element name="sniglet" type="tns:Sniglet"
                       minOccurs="0" maxOccurs="unbounded"
                       nillable="true" />
        </xsd:sequence>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>


  <!-- Define a Sniglet -->

  <xsd:complexType name="Sniglet">
    <xsd:all>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="value" type="xsd:string"/>
    </xsd:all>
  </xsd:complexType>

</xsd:schema>



--------------  INSTANCE DOC  (Foo.xml) ------------------

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns:m="http://www.bar.com/soap1_1/"
   xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
soap-envelope.xsd
           http://www.bar.com/soap1_1/ Foo.xsd">

  <SOAP-ENV:Header />

  <SOAP-ENV:Body>

    <m:SnigletList>
      <m:sniglet>
        <m:name>gimongous</m:name>
        <m:value>Really really big.</m:value>
      </m:sniglet>
    </m:SnigletList>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>





---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org