Tutorial.03

Tutorial.03 - TUTORIAL 3 XP VALIDATING AN XML DOCUMENT New...

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

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 3 1 XP TUTORIAL 3 VALIDATING AN XML DOCUMENT
Background image of page 1

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

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 3 2 XP CREATING A VALID DOCUMENT You validate documents to make certain necessary elements are never omitted. For example, each customer order should include a customer name, address, and phone number.
Background image of page 2
New Perspectives on XML, 2nd Edition Tutorial 3 3 XP CREATING A VALID DOCUMENT Some elements and attributes may be optional, for example an e-mail address. An XML document can be validated using either DTDs (Document Type Definitions) or schemas.
Background image of page 3

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

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 3 4 XP CUSTOMER INFORMATION COLLECTED BY KRISTEN This figure shows customer information collected by Kristen
Background image of page 4
New Perspectives on XML, 2nd Edition Tutorial 3 5 XP THE STRUCTURE OF KRISTEN’S DOCUMENT This figure shows the overall structure of Kristen’s document
Background image of page 5

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

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 3 6 XP DECLARING A DTD A DTD can be used to: Ensure all required elements are present in the document Prevent undefined elements from being used Enforce a specific data structure Specify the use of attributes and define their possible values Define default values for attributes Describe how the parser should access non-XML or non-textual content
Background image of page 6
New Perspectives on XML, 2nd Edition Tutorial 3 7 XP DECLARING A DTD There can only be one DTD per XML document. A document type definition is a collection of rules or declarations that define the content and structure of the document. A document type declaration attaches those rules to the document’s content.
Background image of page 7

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

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 3 8 XP DECLARING A DTD You create a DTD by first entering a document type declaration into your XML document. DTD in this tutorial will refer to document type definition and not the declaration. While there can only be one DTD, it can be divided into two parts: an internal subset and an external subset.
Background image of page 8
New Perspectives on XML, 2nd Edition Tutorial 3 9 XP DECLARING A DTD An internal subset is declarations placed in the same file as the document content. An external subset is located in a separate file.
Background image of page 9

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

View Full DocumentRight Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 3 10 XP DECLARING A DTD The DOCTYPE declaration for an internal subset is: <!DOCTYPE root [ declarations ]> Where root is the name of the document’s root element, and declarations are the statements that comprise the DTD.
Background image of page 10
Tutorial 3 11 XP DECLARING A DTD The DOCTYPE declaration for external subsets can take two forms: one that uses a SYSTEM location and one that uses a PUBLIC location. The syntax is:
Background image of page 11

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

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/26/2010 for the course CS 178 taught by Professor Mandyam during the Spring '10 term at Ohlone.

Page1 / 57

Tutorial.03 - TUTORIAL 3 XP VALIDATING AN XML DOCUMENT New...

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

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