[dsdl-comment] Problem with specifying the <Book> section occur only within the <soap:Body> element

From: Costello, Roger L. <costello@mitre.org>
Date: Mon May 19 2008 - 22:49:56 UTC

Hi Folks,

I want to restrict the <Book> section to occur only within the
<soap:Body> element, as shown here:

------------------------------------------
SOAP-Book.xml
------------------------------------------
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
          <Book xmlns="http://www.books.com">
             <Title>The Wisdom of Crowds</Title>
             <Author>James Surowiecki</Author>
             <Date>2005</Date>
             <ISBN>0-385-72170-6</ISBN>
             <Publisher>Anchor Books</Publisher>
         </Book>
      </soap:Body>
</soap:Envelope>

Here is my NVDL script:

------------------------------------------
SOAP-Book.nvdl
------------------------------------------
<?xml version="1.0"?>
<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"
       startMode="soap">
     <mode name="soap">
         <namespace ns="http://schemas.xmlsoap.org/soap/envelope/">
             <validate schema="soap.xsd">
                 <context path="Body" useMode="book" />
             </validate>
         </namespace>
     </mode>
     <mode name="book">
         <namespace ns="http://www.books.com">
             <validate schema="Book.rng" />
             <attach />
         </namespace>
     </mode>
</rules>

When I run it using oNVDL I get an error message saying that I have an
error in my instance document, at the <Book> element. What am I doing
wrong? Below is Book.rng and soap.xsd. /Roger

------------------------------------------
Book.rng
------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<element name="Book" xmlns="http://relaxng.org/ns/structure/1.0"
         ns="http://www.books.com">
      <element name="Title">
          <text/>
      </element>
      <element name="Author">
          <text/>
      </element>
      <element name="Date">
          <text/>
      </element>
      <element name="ISBN">
          <text/>
      </element>
      <element name="Publisher">
          <text/>
      </element>
</element>

------------------------------------------
soap.xsd
------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns="http://schemas.xmlsoap.org/soap/envelope/"
            elementFormDefault="unqualified">
    <xsd:element name="Envelope">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="Header" minOccurs="0"/>
                <xsd:element ref="Body"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Header">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:any namespace="##other" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:attribute name="mustUnderstand" type="xsd:boolean"
default="false"/>
    <xsd:element name="Body">
        <xsd:complexType>
            <xsd:choice>
                <xsd:any namespace="##other" maxOccurs="unbounded"/>
                <xsd:element ref="Fault"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Fault">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="faultcode" type="xsd:QName"/>
                <xsd:element name="faultstring" type="xsd:string"/>
            <xsd:element name="faultactor" type="xsd:anyURI"/>
                <xsd:element name="detail" minOccurs="0">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:any namespace="##other"
maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

--
DSDL comments
To unsubscribe, please send a message with the
command  "unsubscribe" to dsdl-comment-request@dsdl.org
(mailto:dsdl-comment-request@dsdl.org?Subject=unsubscribe)
Received on Tue May 20 00:51:07 2008

This archive was generated by hypermail 2.1.8 : Tue May 20 2008 - 08:23:05 UTC