XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] NVDL Question: validate one part of a compound document, independent of other parts?


Thanks a lot Jirka! 

I implemented and ran my example (Book + NY Times) compound document
using the NVDL script that Jirka provided.

NVDL is very cool!

If others would like to try NVDL, I provide below everything you need
to get started.

1. Download and unzip the Oxygen XML implementation of NVDL here:

http://www.oxygenxml.com/onvdl.html

2. Here is a compound document (Book-Plus-NYtimes.xml):

<?xml version="1.0"?>
<Book xmlns="http://www.books.com";>
    <Title>The Wisdom of Crowds</Title>
    <Author>James Surowiecki</Author>
    <nytimes:NewYorkTimes xmlns:nytimes="http://www.nytimes.com";>
        <nytimes:role>Staff writer</nytimes:role>
        <nytimes:column>The Financial Page</nytimes:column>
    </nytimes:NewYorkTimes>
    <Date>2005</Date>
    <ISBN>0-385-72170-6</ISBN>
    <Publisher>Anchor Books</Publisher>
</Book>

2.1 Here is Book.xsd

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema";
        targetNamespace="http://www.books.com";
        elementFormDefault="qualified">
    <element name="Book">
        <complexType>
            <sequence>
                <element name="Title" type="string"/>
                <element name="Author" type="string"/>
                <element name="Date" type="gYear"/>
                <element name="ISBN" type="string"/>
                <element name="Publisher" type="string"/>
            </sequence>
        </complexType>
    </element>
</schema>

2.2 Here is NYtimes.xsd

<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema";
        targetNamespace="http://www.nytimes.com";
        elementFormDefault="qualified">
    <element name="NewYorkTimes">
        <complexType>
            <sequence>
                <element name="role" type="string"/>
                <element name="column" type="string"/>
            </sequence>
        </complexType>
    </element>
</schema>

3. Here is the NVDL script (Book-Plus-NYtimes.nvdl):

<?xml version="1.0"?>
<rules xmlns="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0";>
   <namespace ns="http://www.books.com";>
     <validate schema="Book.xsd"/>
   </namespace>
   <namespace ns="http://www.nytimes.com";>
     <validate schema="NYtimes.xsd"/>
   </namespace>
</rules>

4. At a command line, type this:

java -jar path-to-the-oxygen-onvdl-folder/onvdl/bin/onvdl.jar
Book-Plus-NYtimes.nvdl Book-Plus-NYtimes.xml

5. There will be no errors.  Now introduce an error into the Book
portion of the compound document (Book-Plus-NYtimes.xml).  See the
errors for the Book portion.  Next, introduce errors for the NYTimes
portion.  See the errors for the NYTimes portion.

Awesome!

/Roger



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS