100% found this document useful (4 votes)
113 views13 pages

Basic XML

The document discusses basic XML concepts such as tags, elements, and attributes that define the structure of XML documents. It also covers XML entities, well-formed and valid XML documents, document type definitions (DTDs) that specify elements and attributes, and XML Schema as an alternative to DTDs. Examples are provided of XML, DTD, and Schema concepts.

Uploaded by

satyanarayana
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT or read online on Scribd
100% found this document useful (4 votes)
113 views13 pages

Basic XML

The document discusses basic XML concepts such as tags, elements, and attributes that define the structure of XML documents. It also covers XML entities, well-formed and valid XML documents, document type definitions (DTDs) that specify elements and attributes, and XML Schema as an alternative to DTDs. Examples are provided of XML, DTD, and Schema concepts.

Uploaded by

satyanarayana
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT or read online on Scribd
You are on page 1/ 13

Basic XML Concepts

Web Programming
Maymester 2004
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
Example XML document
XML/HTML entities
• Some symbols cannot appear in
document content because they confuse
parsing
• Entities represent these symbols
&lt; <
&gt; >
&amp; &
&quot; “ (double quote)
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
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
Document Type Definition
• Example: a letter contains a source and
destination address, a salutation, one or
more paragraphs, and a closing
DTD Attribute Definitions
• REQUIRED: must always appear
• IMPLIED: optional
• FIXED: required, and always has same
value
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
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:


XML Schema
• Document definition file is also an XML
document, unlike DTD
• Gives much tighter control over contents
of XML document
• See
http://www.w3.org/TR/2000/CR-xmlschema-0-
for details
XHTML
• HTML that conforms to XML format
• Stricter grammar rules than HTML 4.01
Strict
• All tag names in lower case
• V
Acknowledgements
Examples taken from Sun J2EE tutorial,
http://java.sun.com/webservices/docs/1.3/tut
orial/doc/IntroXML.html

You might also like