9
XML (Extensible Markup Language) Prepared by: Jaclyn Soh

XML (Extensible Markup Language)

Embed Size (px)

DESCRIPTION

XML (Extensible Markup Language). Prepared by: Jaclyn Soh. XML (Extensible Markup Language). a language for describing structured data. improves on the HTML approach & makes the web a better place in which to do a business, to learn, and to have fun. - PowerPoint PPT Presentation

Citation preview

Page 1: XML (Extensible Markup Language)

XML (Extensible Markup Language)

Prepared by: Jaclyn Soh

Page 2: XML (Extensible Markup Language)

XML (Extensible Markup Language)

a language for describing structured data.

improves on the HTML approach & makes the web a better place in which to do a business, to learn, and to have fun.

have a freedom to use pretty much any names you like to tag up your data.

Page 3: XML (Extensible Markup Language)

Example

<!-- HTML Snippet --><h1>Invoice</h1><p>From: Jaclyn Soh<p>To: Whoever<p>Amount: $100.00<p>Tax: 21%<p>Total Due: $121.00View in .html

<!-- XML Snippet --><Invoice><From>Jaclyn Soh</From><To>Whoever</To><Date>Year=‘2001’ month=‘4’ day=’16’/><Amount currency = ‘Dollars’>100.00</Amount><TaxRate>21</TaxRate><TotalDue currency = ‘Dollars’>121.00</TotalDue></Invoice>View in .xml from .xml to .html

Page 4: XML (Extensible Markup Language)

XML – Cont.

any language based on XML consists of a set of element types that have been given certain names & certain meanings.

the presence of elements of various types in documents is indicated by tags that serve to indicate where the element starts and ends.

a set of element types serves to define types of documents and are referred to as Document Type Definitions, or DTD.

Page 5: XML (Extensible Markup Language)

XSL – Extensible Stylesheet Language

Extensible Stylesheet Language (XSL)

relationship between XML and XSL is similar to the relationship between HTML and CSS.

example

Page 6: XML (Extensible Markup Language)

More XML…

strictly hierarchical. can have only one root element.Example: <Invoice> document, the <Invoice> element is called root element.

root element is the top-level element in the document, and all the other elements are its children or descendents.

Page 7: XML (Extensible Markup Language)

XML – Generosity???

indeed! XML is very generous in the names we’re allowed to use.For example, there aren’t any reserved words to avoid in XML, as there are in most programming languages. We have a lot flexibility in this regard.

However…

Page 8: XML (Extensible Markup Language)

Some rules to follows:• names can start with letters (including non-Latin characters) or the “_” character, but not numbers or other punctuation characters.

• after the first character, numbers are allowed, as are the characters “_” and “.”.

• names can’t contain spaces.

• names can’t contain the “:” character.

• names can’t start with letters “xml”, in uppercase, lowercase, or mixed.

• there can’t be a space after the opening “<“ character; the name of the element must come immediately after it.

• case sensitive.For example, <first> is different from <FIRST>

Page 9: XML (Extensible Markup Language)

Questions

1. XML is used for describing structural data. (T/F)2. XML document can have more than one root element. (T/F)3. XML is not case sensitive. (T/F)4. XML allows you to create your own tags to precisely describe

data. (T/F)5. Names can start with letters, characters, numbers and

punctuation. (T/F)