1 Example 23
2 Constraint Between Components Consider an XML instance document that has two parts: 1.The "what" part describes - using a standard taxonomy - what's in the other part. 2. The "payload" part contains a data component. EXAMPLE #1 The "what" part uses the DMOZ taxonomy to provide the hierarchy for a philosophy book. The "payload" part contains data on a philosophy book. The First and Last Freedom J. Krishnamurti Harper & Row
3 Constraint Between Components EXAMPLE #2 The "what" part uses the DMOZ taxonomy to provide the hierarchy for the Chinese language. The "payload" part contains data on the Chinese language. Ta
4 Constraint Between Components PROBLEM How do you create an NVDL script which will validate that: If the value of the taxonomy attribute is then validate the data component in against: the Book schema If the value of the taxonomy attribute is then validate the data component in against: the Chinese schema Further... the data components in may be expressed in any schema language (XML Schema, Relax NG, DTD, Schematron). How would you create an NVDL script to do this?
5 An NVDL Processor Divides the Instance into Sections N V D L processor Ta Ta
6 … and then Validates each Section N V D L processor Ta Ta Document.xsd Validate Chinese.xsd
7 N V D L processor Ta Ta How do we express the constraint between the taxonomy value and the payload value?
8 Acknowledgement Thanks to George Cristian Bina for explaining to me how to solve this problem (see the following slides for the solution). Thanks George!
9 Solution Validate each section independently –Validate the Document section against Document.xsd –Validate the payload section against it's schema Validate a Book section against Book.xsd Validate a Chinese section against Chinese.xsd Attach the payload section to its parent (Document) section and then use Schematron to validate the relationship between the taxonomy and the payload
10 NVDL Script <rules xmlns=" startMode="example"> See following slides for an explanation
11 <rules xmlns=" startMode="example"> Validate the Document section against Document.xsd and then for the child (payload) section switch to the content mode.
12 <rules xmlns=" startMode="example"> Validate a payload against book.xsd and a payload against chinese.xsd
13 <rules xmlns=" startMode="example"> Attach any child sections of to its parent, and then use a Schematron schema to validate constraints between the sections.
14 Schematron expresses the constraint between the taxonomy value and the payload When taxonomy is the Payload should contain content from the namespace When taxonomy is the Payload should contain content from the namespace
15 Implementation See the folder example23 for the NVDL script, the schemas, and actual XML instances.
16 Validating Constraints Across Components This example has shown how to express constraints across components Furthermore, the components can be expressed in different schema languages. Relax NG DTD Schematron XML Schema Wow!