W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2001

Re: namespaces with schema - I need Help immediate!

From: Bob Schloss <rschloss@us.ibm.com>
Date: Wed, 22 Aug 2001 12:47:53 -0400
To: Nelson Miranda <nmiranda@CPCIS.pt>
Cc: xmlschema-dev@w3.org
Message-ID: <OF75263699.239D0BD5-ON85256AB0.005C0861@pok.ibm.com>

Nelson,

     I do not know whether you are using Xerces-C or Xerces-J,
and whether you are using Xerces-J 1.4.x or Xerces-J 2.

     There is a mailing list where Xerces-J users help each other.
Please post your questions there, if that is what you use.
 xerces-j-user@xml.apache.org

          Thank you,
          Bob


Nelson Miranda <nmiranda@CPCIS.pt>@w3.org on 07/10/2001 10:09:50 AM

Sent by:  xmlschema-dev-request@w3.org


To:   xmlschema-dev@w3.org
cc:
Subject:  namespaces with schema - I need Help immediate!



Hello,
Please, could somebody explain why the parser xerces donīt parse the
document below when i specify the location of the shema using an
xsi:schemaLocation and parse the document using an
xsi:noNamespaceSchemaLocation?
I think that the document donīt use namespaces and then i could use an
xsi:noNamespaceSchemaLocation, donīt is?

the document is(po.xml):

<?xml version="1.0" encoding="UTF-8"?>
<purchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="po.xsd">
     <shipTo>
          <name>Alice Smith</name>
          <street>123 Maple Street</street>
          <city>Mill Valley</city>
          <state>CA</state>
          <zip>90952</zip>
     </shipTo>
     <billTo>
          <name>Robert Smith</name>
          <street>8 Oak Avenue</street>
          <city>Old Town</city>
          <state>PA</state>
          <zip>95819</zip>
     </billTo>
     <items>
          <item partNum="872-AA">
               <productName>Lawnmower</productName>
               <quantity>1</quantity>
               <USPrice>148.95</USPrice>
               <comment>Confirm this is electric</comment>
               <shipDate>1999-05-01</shipDate>
          </item>
          <item partNum="926-AA">
               <productName>Baby Monitor</productName>
               <quantity>1</quantity>
               <USPrice>39.98</USPrice>
               <shipDate>1999-05-21</shipDate>
          </item>
     </items>
</purchaseOrder>

and the schema is(po.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
     <xsd:annotation>
          <xsd:documentation>Purchase order shema for Example.com.
Coyright 2000 Example.com. All rights reserved.</xsd:documentation>
     </xsd:annotation>
     <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
     <xsd:element name="comment" type="xsd:string"/>
     <xsd:complexType name="PurchaseOrderType">
          <xsd:sequence>
               <xsd:element name="shipTo" type="USAddress"/>
               <xsd:element name="billTo" type="USAddress"/>
               <xsd:element ref="comment" minOccurs="0"/>
               <xsd:element name="items" type="Items"/>
          </xsd:sequence>
          <xsd:attribute name="OrderDate" type="xsd:date"/>
     </xsd:complexType>
     <xsd:complexType name="USAddress">
          <xsd:sequence>
               <xsd:element name="name" type="xsd:string"/>
               <xsd:element name="street" type="xsd:string"/>
               <xsd:element name="city" type="xsd:string"/>
               <xsd:element name="state" type="xsd:string"/>
               <xsd:element name="zip" type="xsd:decimal"/>
          </xsd:sequence>
     </xsd:complexType>
     <xsd:complexType name="Items">
          <xsd:sequence>
               <xsd:element name="item" minOccurs="0"
maxOccurs="unbounded">
                    <xsd:complexType>
                         <xsd:sequence>
                              <xsd:element
name="productName" type="xsd:string"/>
                              <xsd:element
name="quantity">
                                   <xsd:simpleType>

<xsd:restriction base="xsd:positiveInteger">

<xsd:maxExclusive value="100"/>

</xsd:restriction>
                                   </xsd:simpleType>
                              </xsd:element>
                              <xsd:element name="USPrice"
type="xsd:decimal"/>
                              <xsd:element ref="comment"
minOccurs="0"/>
                              <xsd:element name="shipDate"
type="xsd:date"/>
                         </xsd:sequence>
                         <xsd:attribute name="partNum"
type="SKU" use="required"/>
                    </xsd:complexType>
               </xsd:element>
          </xsd:sequence>
     </xsd:complexType>
     <xsd:simpleType name="SKU">
          <xsd:restriction base="xsd:string">
               <xsd:pattern value="\d{3}-[A-Z]{2}"/>
          </xsd:restriction>
     </xsd:simpleType>
</xsd:schema>

finally, someone can give me an example with schemas and namespaces that
the
parser xerces parse with no errors?

Thanks!
Received on Wednesday, 22 August 2001 12:48:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:23 GMT