Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Programming Maymester 2004

Similar presentations


Presentation on theme: "Web Programming Maymester 2004"— Presentation transcript:

1 Web Programming Maymester 2004
Basic XML Concepts Web Programming Maymester 2004

2 XML fundamental concepts
XML is not a language, but a structure for defining application-specific mini-languages Tags, elements and attributes Tag names can be ANYTHING (depends on application

3 Example XML document

4 XML/HTML entities Some symbols cannot appear in document content because they confuse parsing Entities represent these symbols < > & & " “ (double quote)

5 Well-Formed XML document
Every tag has a matching closing tag Tags are properly nested You can have an empty element, which is its own matching close tag <danger voltage=“480” /> All attribute values appear in quotes

6 Valid XML document A valid document must be well-formed
In addition, the document conforms to a language definition The language definition specifies possible tags, their contents, and their attributes Two types of language definitions: Document Type Definition (DTD) XML Schema

7 Document Type Definition
Example: a letter contains a source and destination address, a salutation, one or more paragraphs, and a closing

8 DTD Attribute Definitions
REQUIRED: must always appear IMPLIED: optional FIXED: required, and always has same value

9 DTD Data Types & Quantifiers
#PCDATA =“parsed character data”, can contain no XML markup chars Use entities to replace markup chars “X+” means one or more instances of X “X*” means zero or more instances of X “X?” means zero or one instances of X

10 Where to put DTDs Can be embedded in the DOCTYPE declaration, as in previous example SYSTEM DTD refers to a file on the same machine: PUBLIC DTD gives a URL to the DTD:

11 XML Schema Document definition file is also an XML document, unlike DTD Gives much tighter control over contents of XML document See for details

12 XHTML HTML that conforms to XML format
Stricter grammar rules than HTML 4.01 Strict All tag names in lower case V

13 Acknowledgements Examples taken from Sun J2EE tutorial,


Download ppt "Web Programming Maymester 2004"

Similar presentations


Ads by Google