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

RE: NVDL Question: validate one part of a compound document, i

  • From: "Costello, Roger L." <costello@m...>
  • To: <xml-dev@l...>
  • Date: Fri, 18 Apr 2008 18:58:04 -0400

RE:  NVDL Question: validate one part of a compound document

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]


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.