OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Associating an XML Schema with a XML Document

[ Lists Home | Date Index | Thread Index ]

I have the following Schema and XML files...
I want to specify that the xml is based on the schema defined as file : booksextended.xsd
Could someone tell me what I'm doing wrong on the xml file ?
 
XML Schema :
 
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="author" type="xsd:string"/>
    <xsd:element name="book">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="author"/>
                <xsd:element ref="title"/>
                <xsd:choice maxOccurs="1" minOccurs="0">
                    <xsd:element ref="publisher"/>
                    <xsd:element ref="supplier"/>
                </xsd:choice>
                <xsd:element ref="price"/>
            </xsd:sequence>
            <xsd:attribute name="isbn" type="xsd:string" use="optional"/>
            <xsd:attribute name="reference" type="xsd:string" use="optional"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="books">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element maxOccurs="unbounded" minOccurs="1" ref="book"/>
            </xsd:sequence>
            <xsd:attribute name="NewAttribute1" type="xsd:string" use="optional"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="price">
        <xsd:complexType>
            <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                    <xsd:attribute name="onSale" type="xsd:string" use="optional"/>
                    <xsd:attribute name="NewAttribute1"
                        type="xsd:string" use="optional"/>
                    <xsd:attribute name="NewAttribute2"
                        type="xsd:string" use="optional"/>
                </xsd:extension>
            </xsd:simpleContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="title" type="xsd:string"/>
    <xsd:element name="publisher" type="xsd:string"/>
    <xsd:element name="supplier" type="xsd:string"/>
</xsd:schema>
XML Document
 
<?xml version="1.0" encoding="UTF-8"?>
<books xmlns="http://www.books.org"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="file://d//ibm//dev//workspaces//dominoportal//dominoadapter booksextended.xsd">
 <book reference="1">
  <author>Tom Wolfe</author>
  <title>The Right Stuff</title>
  <price>$6.00</price>
 </book>
 <book>
  <author>R.L. Stevenson</author>
  <title>Treasure Island</title>
  <price>$13.00</price>
 </book>
 <book>
  <author>Carl Hiaasen</author>
  <title>Tourist Season</title>
  <price>$5.99</price>
 </book>
 <book>
  <author>Dave Barry</author>
  <title>Big Trouble</title>
  <price>$3.95</price>
 </book>
</books>
 




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS