ch23 - Chapter Twenty-Three XML Chapter Goals •...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: Chapter Twenty-Three: XML Chapter Goals • Understanding XML elements and attributes • Understanding the concept of an XML parser • Being able to read and write XML documents • Being able to design Document Type Definitions for XML documents XML • Stands for Extensible Markup Language • Lets you encode complex data in a form that the recipient can parse easily • Is independent from any programming language Advantages of XML • Example: encode product descriptions to be transferred to another computer • Naïve encoding: Toaster 29.95 • XML encoding of the same data: <product> <description>Toaster</description> <price>29.95</price> </product> Advantages of XML • XLM files are readable by both computers and humans • XML formatted data is resilient to change • It is easy to add new data elements • Old programs can process the old information in the new data format • In the naïve format a program might think the new data element is the name of the product: Toaster 29.95 General Appliances • When using XML it is easy to add new elements: <product> <description>Toaster</description> <price>29.95</price> <manufacturer>General Appliances</manufacturer> </product> Similarities between XML and HTML • Both use tags • Tags are enclosed in angle brackets • A start-tag is paired with an end-tag that starts with a slash / character • HTML example: <li>A list item</li> • XML example: <price>29.95</price> Differences Between XML and HTML • XML tags are case-sensitive • <LI> is different from <li> • Every XML start-tag must have a matching end-tag • If a tag has no end-tag, it must end in /> <img src="hamster.jpeg"/> • XML attribute values must be enclosed in quotes <img src="hamster.jpeg" width="400" height="300" /> Differences Between XML and HTML • HTML describes web documents • XML can be used to specify many different kinds of data • VRML uses XML syntax to describe virtual reality scenes • MathML uses XML syntax to describe mathematical formulas • You can use the XML syntax to describe your own data • XML does not tell you how to display data; it is a convenient format for representing data Word Processing and Typesetting Systems Word Processing and Typesetting Systems • A formula specified in T E X: \sum_{i=1}^n i^2 • The T E X program typesets the summation: The Structure of an XML Document • An XML data set is called a document • The document starts with a header <?xml version="1.0"?> • The data are contained in a root element <?xml version="1.0"?> <invoice> more data </invoice> • The document contains elements and text The Structure of an XML Document • An XML element has one of two forms < elementName > content </ elementName > or < elementName /> • The content s can be elements or text or both The Structure of an XML Document • An example of an element with both elements and text (mixed content): <p>Use XML for <strong>robust</strong> data formats.</p> • The p element contains...
View Full Document

This note was uploaded on 02/27/2009 for the course SC 418262 taught by Professor Chuleerut during the Spring '08 term at Kasetsart University.

Page1 / 83

ch23 - Chapter Twenty-Three XML Chapter Goals •...

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

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