Well-formed and Valid XML Documents - PowerPoint PPT Presentation

About This Presentation
Title:

Well-formed and Valid XML Documents

Description:

Title: Introduction to XML Author: Kanda Runapongsa Last modified by: Kanda Runapongsa Created Date: 11/6/2003 4:23:27 PM Document presentation format – PowerPoint PPT presentation

Number of Views:37
Avg rating:3.0/5.0
Slides: 7
Provided by: KandaRun
Category:
Tags: xml | documents | formed | valid | well

less

Transcript and Presenter's Notes

Title: Well-formed and Valid XML Documents


1
Well-formed and Valid XML Documents
  • Kanda Runapongsa
  • (krunapon_at_kku.ac.th)
  • Dept. of Computer Engineering
  • Khon Kaen University

2
Well-formed Valid
  • Well-formed XML documents are the XML documents
    that obey XML syntax
  • Valid XML documents are the XML documents that
    follow the rules of the schema of XML documents
  • Well-formed XML documents do not need to be valid

3
Well-formed XML Documents
  • Must have XML Declaration
  • Must have the root element
  • Elements must have a closing tag
  • Elements must be properly nested
  • Element name of the end-tag must match with that
    of the start-tag

4
Well-formed XML Documents (Cont.)
  • Attribute values must always be quoted
  • Element and attribute names cannot be started
    with xml (for both uppercase and lowercase)
  • Special characters (lt and ) cannot be used in
    text as they are used in markup

5
Some Rules for Checking Valid
  • The value of attribute of ID type must be unique
    between all values of all ID attributes
  • The value of IDREF attribute must match the value
    of some ID attribute in the document
  • The value of IDREFS attribute can contain several
    references to elements with ID attribute
    separated with whitespaces.

6
Examples
  • DTD
  • lt!ELEMENT AAA (PCDATA)gt
  • lt!ATTLIST AAA id ID REQUIREDgt
  • lt!ELEMENT BBB (PCDATA)gt
  • lt!ATTLIST BBB ref IDREF REQUIREDgt
  • XML
  • ltAAA id1gtHellolt/AAAgt
  • ltBBB ref1gtHilt/BBBgt
Write a Comment
User Comments (0)
About PowerShow.com