[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Associating an XML Schema with a XML Document

  • To: "List - XML-Dev" <xml-dev@l...>
  • Subject: Associating an XML Schema with a XML Document
  • From: "Luciano Resende (Discussion List)" <llistas@t...>
  • Date: Wed, 29 Oct 2003 23:15:25 -0500

associating xsd with xml
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>
 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.