… … The validation information is embedded within the XML instance document"> … … The validation information is embedded within the XML instance document">
Download presentation
Presentation is loading. Please wait.
Published byNathaniel Whalen Modified over 10 years ago
1
1 How to Specify Validation Information Roger L. Costello 27 December, 2008
2
2 Validation Information <Library xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.book.org Book.xsd http://www.employee.org Employee.xsd"> … … 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.http://www.book.org http://www.employee.org
3
3 Embedded Validation Information <Library xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.book.org Book.xsd http://www.employee.org Employee.xsd"> … … The validation information is embedded within the XML instance document
4
4 It's not always a good idea to embed validation information in XML instance documents Reason #1
5
5 Document Lifecycle Some XML instance documents are validated against different schemas at different stages of the documents lifecycle, particularly in workflow- based applications. Rob SallyPete JillAnthony Schema1 Schema2 Schema3Schema4 XML
6
6 Rob SallyPete JillAnthony Schema1 Schema2 Schema3Schema4 The validation information inside the XML instance document will have to be changed at every stage in the workflow. XML
7
7 It's not always a good idea to embed validation information in XML instance documents Reason #2
8
8 Diverse Schema Languages <Library xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://www.book.org Book.xsd http://www.employee.org Employee.xsd"> … … This validation information is limited to only XSD schemas The XML instance document may be composed of XML vocabularies from different schema languages.
9
9 Popular Tag Sets DTD XHTML Relax NG SVG XML Dig-Sig XML Schema GML Docbook Atom IMS Question & Test DITA MathML OAGI UBL AECMA 1000D See here for a couple hundred more: http://xml.coverpages.org/xmlApplications.htmlhttp://xml.coverpages.org/xmlApplications.html NLM TEI
10
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
11 First, move validation information out of the XML instance and into a separate document
12
12 … … Validation Information XML Instance
13
13 … … Validation Information No validation information in the XML instance document
14
14 … … Validation Information Express the validation information in a machine-processable fashion
15
15 … … Validation Information Express the validation information in XML!
16
16 … … Validation Information Need a standardized XML vocabulary
17
17 Is there a standardized XML vocabulary for expressing validation information, which is also independent of schema language?
18
18 Yes, there is. It's called NVDL.
19
19 NVDL stands for Namespace-based Validation Dispatching Language.
20
20 … … XML Schema Validator Relax NG Validator Schematron Validator DTD Validator NVDL Processor Valid! NVDL XML Instance
21
21 Anatomy of an NVDL Script http://www.book.org http://www.employee.org See following slides for explanation Library.nvdl
22
22 http://www.book.org http://www.employee.org Library.nvdl Validate the items in the http://www.book.org namespace against Book.xsd http://www.book.org
23
23 http://www.book.org http://www.employee.org Library.nvdl Validate the items in the http://www.employee.org namespace against Employee.xsd http://www.employee.org
24
24 http://www.book.org http://www.employee.org Library.nvdl Standardized XML vocabulary
25
25 http://www.book.org http://www.employee.org Library.nvdl Validate the items in the book.org namespace against a Relax NG schema, and the items in the employee.org namespace against an XML Schema Wow!
26
26 XML instance Validation Information Clean separation between data and validation information
27
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.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.