Lecture08 - XML Validation with DTDs http/www.techtutorials.info/dtd.html http/www.xmlfiles.com/dtd

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 8 XML – Validation with DTDs Resources: http://www.w3schools.com/dtd/default.asp ; http://www.techtutorials.info/dtd.html ; http://www.xmlfiles.com/dtd/ http://www.cs.man.ac.uk/~kechen/pages/teaching/comp17032
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP17032 Web Technology and Practice 1 2 Aims and Objectives •A ims Understand the basic structure of a Document Type Definition (DTD) and how it is used to validate XML documents •Ob jec t ives – Element type declarations
Background image of page 2
COMP17032 Web Technology and Practice 1 3 XML Document Model •A document model is used to enforce structure within a document • Two types of document models for XML: –DTD – Document Type Definition – XML Schema • Document models are not obligatory in XML
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP17032 Web Technology and Practice 1 4 Validation of XML Documents • An XML document is valid if it has an associated DTD and if document complies with constraints expressed by DTD referenced • DTD defines the vocabulary and grammar of an XML markup language – DTD specification can be simply a list of all valid elements (elements, tags, attributes), or can specify relationship between elements (e.g. element X must contain either element Y or element Z but never both).
Background image of page 4
COMP17032 Web Technology and Practice 1 5 Why Validate XML Documents? • Since XML is extensible, XML documents can use completely different sets of markup tags as long as syntax is well-formed . • Validating XML provides a mechanism to constrain how markup tags are put together. Useful for: – checking information for accuracy and completeness – documents for others (e.g. humans and software agents) the structure of XML markup – provide portability over Internet for applications to exchange data without having to use pre-defined formats.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP17032 Web Technology and Practice 1 6 Uses of a Document Model •D e f i n e elements your document can contain • Define the order in which elements appear • Require that certain elements appear • Define the allowed number of occurrences of a given element • Define the types of data an element can contain •D e f i n e child elements for a given element • Define the attributes for each of your elements • Assign constraints to attribute values
Background image of page 6
COMP17032 Web Technology and Practice 1 7 Validating Parsers • A validating parser will check an XML document’s structure against a DTD or XML Schema • Documents that conform to a document model are valid • Validating parsers will report an error if the document does not conform to its document model, even if it is well-formed
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP17032 Web Technology and Practice 1 8 Using a Validating Parser • To check a document against a DTD, you must use a validating parser • You can find a validating parser at the following URL: – http://www.stg.brown.edu/service/xmlvalid/ http://msdn.microsoft.com/downloads/samples/inter net/xml/xml_validator (if not exist, use .NET XML developer)
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/20/2008 for the course COMP 17032 taught by Professor Kechen during the Fall '07 term at University of Manchester.

Page1 / 37

Lecture08 - XML Validation with DTDs http/www.techtutorials.info/dtd.html http/www.xmlfiles.com/dtd

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online