XML Extensible Markup Language Prepared by Jaclyn Soh

  • Slides: 9
Download presentation
XML (Extensible Markup Language) Prepared by: Jaclyn Soh

XML (Extensible Markup Language) Prepared by: Jaclyn Soh

XML (Extensible Markup Language) v a language for describing structured data. v improves on

XML (Extensible Markup Language) v a language for describing structured data. v improves on the HTML approach & makes the web a better place in which to do a business, to learn, and to have fun. v have a freedom to use pretty much any names you like to tag up your data.

Example <!-- HTML Snippet --> <h 1>Invoice</h 1> <p>From: Jaclyn Soh <p>To: Whoever <p>Amount:

Example <!-- HTML Snippet --> <h 1>Invoice</h 1> <p>From: Jaclyn Soh <p>To: Whoever <p>Amount: $100. 00 <p>Tax: 21% <p>Total Due: $121. 00 View 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> <Tax. Rate>21</Tax. Rate> <Total. Due currency = ‘Dollars’>121. 00 </Total. Due> </Invoice> View in. xml from. xml to. html

XML – Cont. v any language based on XML consists of a set of

XML – Cont. v any language based on XML consists of a set of element types that have been given certain names & certain meanings. v the presence of elements of various types in documents is indicated by tags that serve to indicate where the element starts and ends. v a set of element types serves to define types of documents and are referred to as Document Type Definitions, or DTD.

XSL – Extensible Stylesheet Language v Extensible Stylesheet Language (XSL) v relationship between XML

XSL – Extensible Stylesheet Language v Extensible Stylesheet Language (XSL) v relationship between XML and XSL is similar to the relationship between HTML and CSS. v example

More XML… v strictly hierarchical. v can have only one root element. Example: <Invoice>

More XML… v strictly hierarchical. v can have only one root element. Example: <Invoice> document, the <Invoice> element is called root element. v root element is the top-level element in the document, and all the other elements are its children or descendents.

XML – Generosity? ? ? v indeed! XML is very generous in the names

XML – Generosity? ? ? v 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. v However…

Some rules to follows: • names can start with letters (including non-Latin characters) or

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>

Questions 1. 2. 3. 4. XML is used for describing structural data. (T/F) XML

Questions 1. 2. 3. 4. XML is used for describing structural data. (T/F) XML document can have more than one root element. (T/F) XML is not case sensitive. (T/F) 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)