How to Specify Validation Information - PowerPoint PPT Presentation

About This Presentation
Title:

How to Specify Validation Information

Description:

The validation information is embedded within the XML instance document. 4 ... is embedded in the instance document then the instance document will need ... – PowerPoint PPT presentation

Number of Views:62
Avg rating:3.0/5.0
Slides: 28
Provided by: RogerLC7
Category:

less

Transcript and Presenter's Notes

Title: How to Specify Validation Information


1
How to Specify Validation Information
  • Roger L. Costello
  • 27 December, 2008

2
Validation Information
Validate the items in the http//www.book.org
namespace against Book.xsd, and the items in the
http//www.employee.org namespace against
Employee.xsd.
lt?xml version"1.0"?gt ltLibrary xmlnsxsi"http//w
ww.w3.org/2001/XMLSchema-instance"
xsischemaLocation
"http//www.book.org
Book.xsd http//www.employee.o
rg Employee.xsd"gt
ltBooksgt lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
3
Embedded Validation Information
lt?xml version"1.0"?gt ltLibrary xmlnsxsi"http//w
ww.w3.org/2001/XMLSchema-instance"
xsischemaLocation
"http//www.book.org
Book.xsd http//www.employee.o
rg Employee.xsd"gt
ltBooksgt lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
The validation information is embedded within the
XML instance document
4
It's not always a good idea to embed validation
information in XML instance documents
Reason 1 ?
5
Document Lifecycle
  • Some XML instance documents are validated against
    different schemas at different stages of the
    documents lifecycle, particularly in
    workflow-based applications.

Schema3
Schema4
Schema2
Schema1
XML
6
The validation information inside the XML
instance document will have to be changed at
every stage in the workflow.
Schema3
Schema4
Schema2
Schema1
XML
7
It's not always a good idea to embed validation
information in XML instance documents
Reason 2 ?
8
Diverse Schema Languages
  • The XML instance document may be composed of XML
    vocabularies from different schema languages.

lt?xml version"1.0"?gt ltLibrary xmlnsxsi"http//w
ww.w3.org/2001/XMLSchema-instance"
xsischemaLocation
"http//www.book.org
Book.xsd http//www.employee.o
rg Employee.xsd"gt
ltBooksgt lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
This validation information is limited to only
XSD schemas
9
Popular Tag Sets
DTD
Relax NG
MathML
AECMA 1000D
Atom
SVG
TEI
XHTML
Docbook
TEI
OAGI
XML Dig-Sig
NLM
DITA
NLM
XML Schema
UBL
GML
NLM
IMS Question Test
AECMA 1000D
See here for a couple hundred more
http//xml.coverpages.org/xmlApplications.html
10
If I don't put the validation information inside
the XML instance document, where do I put that
information? How do I express the information in
a way that is not specific to one schema language?
11
First, move validation information out of the XML
instance and into a separate document ?
12
XML Instance
lt?xml version"1.0"?gt ltLibrarygt ltBooksgt
lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
Validation Information
13
No validation information in the XML instance
document
lt?xml version"1.0"?gt ltLibrarygt ltBooksgt
lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
Validation Information
14
lt?xml version"1.0"?gt ltLibrarygt ltBooksgt
lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
Validation Information
Express the validation information in a
machine-processable fashion
15
lt?xml version"1.0"?gt ltLibrarygt ltBooksgt
lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
Validation Information
Express the validation information in XML!
16
lt?xml version"1.0"?gt ltLibrarygt ltBooksgt
lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
Validation Information
Need a standardized XML vocabulary
17
Is there a standardized XML vocabulary for
expressing validation information, which is also
independent of schema language?
18
Yes, there is. It's called NVDL.
19
NVDL stands for Namespace-based Validation
Dispatching Language.
20
XML Instance
lt?xml version"1.0"?gt ltLibrarygt ltBooksgt
lt/Booksgt ltEmployeesgt
lt/Employeesgt lt/Librarygt
NVDL Processor
XML Schema Validator
Relax NG Validator
Valid!
Schematron Validator
DTD Validator
NVDL
21
Anatomy of an NVDL Script
ltrules xmlns"http//purl.oclc.org/dsdl/nvdl/ns/st
ructure/1.0"gt ltnamespace ns"http//www.book
.org"gt ltvalidate schema"Book.xsd"
/gt lt/namespacegt ltnamespace
ns"http//www.employee.org"gt
ltvalidate schema"Employee.xsd" /gt
lt/namespacegt lt/rulesgt
Library.nvdl
See following slides for explanation ?
22
Validate the items in the http//www.book.org
namespace against Book.xsd
ltrules xmlns"http//purl.oclc.org/dsdl/nvdl/ns/st
ructure/1.0"gt ltnamespace ns"http//www.book
.org"gt ltvalidate schema"Book.xsd"
/gt lt/namespacegt ltnamespace
ns"http//www.employee.org"gt
ltvalidate schema"Employee.xsd" /gt
lt/namespacegt lt/rulesgt
Library.nvdl
23
Validate the items in the http//www.employee.org
namespace against Employee.xsd
ltrules xmlns"http//purl.oclc.org/dsdl/nvdl/ns/st
ructure/1.0"gt ltnamespace ns"http//www.book
.org"gt ltvalidate schema"Book.xsd"
/gt lt/namespacegt ltnamespace
ns"http//www.employee.org"gt
ltvalidate schema"Employee.xsd" /gt
lt/namespacegt lt/rulesgt
Library.nvdl
24
ltrules xmlns"http//purl.oclc.org/dsdl/nvdl/ns/st
ructure/1.0"gt ltnamespace ns"http//www.book
.org"gt ltvalidate schema"Book.xsd"
/gt lt/namespacegt ltnamespace
ns"http//www.employee.org"gt
ltvalidate schema"Employee.xsd" /gt
lt/namespacegt lt/rulesgt
Standardized XML vocabulary
Library.nvdl
25
Wow!
ltrules xmlns"http//purl.oclc.org/dsdl/nvdl/ns/st
ructure/1.0"gt ltnamespace ns"http//www.book
.org"gt ltvalidate schema"Book.rng"
/gt lt/namespacegt ltnamespace
ns"http//www.employee.org"gt
ltvalidate schema"Employee.xsd" /gt
lt/namespacegt lt/rulesgt
Validate the items in the book.org namespace again
st a Relax NG schema, and the items in the
employee.org namespace against an XML Schema
Library.nvdl
26
XML instance
Clean separation between data and validation
information
Validation Information
27
Summary
  • Oftentimes XML developers embed validation
    information within their instance documents.
  • This may not be a good idea for these reasons
  • In the lifecycle of an instance document it may
    need to be validated against different schemas.
    If validation information is embedded in the
    instance document then the instance document will
    need to be changed at each stage of the
    lifecycle. That's costly.
  • The embedded validation information is limited to
    one schema language. You may want to utilize XML
    vocabularies that were created using different
    schema languages.
  • Recommendations
  • Remove validation information from XML instance
    documents.
  • Put the validation information into a separate
    document.
  • Use a standardized XML vocabulary for expressing
    validation information.
  • NVDL is a standardized XML vocabulary for
    expressing validation information. Use NVDL.
Write a Comment
User Comments (0)
About PowerShow.com