{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This preview shows pages 1–13. 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
Image of page 1

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

View Full Document Right 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.
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.
Image of page 3

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

View Full Document Right 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
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
Image of page 5

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

View Full Document Right 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
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.
Image of page 7

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

View Full Document Right 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.
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.
Image of page 9

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

View Full Document Right 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.
Image of page 10
New Perspectives on XML, 2nd Edition 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: <!DOCTYPE root SYSTEM “ uri ”> or <!DOCTYPE root PUBLIC “ id ” “ uri ”>
Image of page 11

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

View Full Document Right Arrow Icon
New Perspectives on XML, 2nd Edition Tutorial 3 12 XP DECLARING A DTD Here, root is the document’s root element, identifier is a text string that tells an application how to locate the external subset, and uri is the location and filename of the external subset.
Image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern