[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
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|