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

From: Costello, Roger L. <costello@mitre.org>
Date: Tue May 20 2008 - 15:33:58 UTC

Thanks a lot George. That fixed the problem.

Below is the working version. Some people may find it to be a good
example of using the NVDL <context> element. /Roger

------------------------------------------
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>

------------------------------------------
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>

------------------------------------------
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" processContents="lax"
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" processContents="lax"
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"
processContents="lax" 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 17:34:17 2008

This archive was generated by hypermail 2.1.8 : Wed May 21 2008 - 20:03:17 UTC