2a.1 A review of the XML mark-up language Copyright B. Wilkinson, 2008. This material is the property of Professor Barry Wilkinson (UNC- Charlotte) and is for the sole and exclusive use of the students enrolled in the Fall 2008 Grid computing course broadcast on the North Carolina Research and Education Network (NCREN) to universities across North Carolina. Sept 29, 2008
48
Embed
2a.1 A review of the XML mark-up language Copyright B. Wilkinson, 2008. This material is the property of Professor Barry Wilkinson (UNC-Charlotte) and.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
2a.1
A review of the XML mark-up language
Copyright B. Wilkinson, 2008. This material is the property of Professor Barry Wilkinson (UNC-Charlotte) and is for the sole and exclusive use of the students enrolled in the Fall 2008 Grid computing course broadcast on the North Carolina
Research and Education Network (NCREN) to universities across North Carolina. Sept 29, 2008
2a.2
Questions
1. Put your and up if you know HTML
2. Put your hand up if you know XML
If yes to both, next part will be easy.
XML Mark-up Language
Use in Grid computing:
Already seen informally in:•Job submission and scheduling
• Job description languages
Will shortly see in:
• Software Infrastructure• Web Services Description• Deployment Description
2a.3
Mark-up languages
• A way of describing information in a regular format that can be read by computer or humans
• Uses “tags’ that identify and delinerate information
• Enable information to be interpreted and processed by computer programs in a platform-independent way.
• Concept developed in 1960’s and 1970s notably with IBM’s mark-up language Generalized Markup Language (GML) developed in the 1960s.
2a.4
2a.5
Standard Generalized Mark-Up Language (SGML)
A mark-up language specification ratified in 1986.
• Key aspect – Using pairs of tags that surround information - a begin
tag <tag_name> and a matching end tag </tag_name> .
Example
<title> Grid Computing </title>
Begin tag End tag
Information (body)
Mark-up languages
• Note the / in the end tag.
• When using multiple tag pairs, they must be nested properly.
• Different mark-up languages will use specific names for their tags.
2a.6
2a.7
HyperText Markup Language (HTML)
A mark-up language used in web pages.
“Hypertext” refers to the text’s ability to link to other documents.
“Markup” refers to providing information to tell browser how to display page and other things.
2a.8
HTML page format
<HTML><HEAD>
</HEAD><BODY>
</BODY></HTML>
Signifies an HTML document
Head section includes information about document - “metadata”
Body section contains text and references to images to be displayed
End of document
2a.9
HTML Tags
• Tags specify details such as type of text.
Example
<B> to start bold text </B> to end bold text
<I> to start italic text </I> to end italic text
Some tags in HTML are not in pairs
<BR> Line break tag
<P> New paragragh (line break + blank line)
2a.10
HTML page<HTML><HEAD>
</HEAD><BODY>
Hello world<BR><I> My name is <B>Tom</B> </I>
</BODY></HTML>
2a.11
QuestionWhat does the previous HTML page display?
Answer
Hello WorldMy name is Tom
2a.12
Attributes
Many tags can have attributes which specify something about the body between tag pair.
Example
<FONT COLOR=red SIZE=3 FACE=Times>This text is displayed in red in Times font, about 12 pt.</FONT>
Attributes
2a.13
XML(Extensible Mark-up Language)
• Ratified in 1998 - very important standard mark-up language - a “simplified” SGML.
• Developed to represent textual information in a structured manner that could be read and interpreted by a computer or a human.
• A foundation for Web services.
2a.14
Some key aspects of XML
• Tags always used in pairs delineate information to make it easy to process.
- Exception: when body between tags holds nothing. Then a single tag <tag_name/> can be used.
• Tags can be nested
• Names of tags not predefined as in HTML, but defined usually in a separate document called a schema.
• Creates multitude of “XML” languages.
2a.15
XML Tag Attributes
• As in HTML, attributes provide a way of providing information rather than in body between the tags.
• Use of attributes rather than the body is application dependent.
• Often have both attributes and a body.
2a.16
XML documents can be created by humans or automatically by computer.
In our application, they are processed by computer.
As we shall see, even when generated by computer programs, programmers still have to be able to read these documents to fully understand what’s going on.
<name>Department of Computer Science</name><company>University of North Carolina at Charlotte</company><street> 9201 University City Blvd.</street><city>Charlotte</city><state>NC</state><postalCode>28223</postalCode>
</billTo><shipTo>
<name>Department of Computer Science</name><company> University of North Carolina at Charlotte </company><street>9201 University City Blvd.</street><city>Charlotte</city><state>NC</state><postalCode>28223</postalCode>
</shipTo><items> <item productCode=“456-CS”>
<description>computer model 1234 </description><quantity>3</quantity><price>1234.78</price>
</item></items></purchaseOrder>
2a.18
Example of attributes and a body
<order> <item productCode=“456-CS”><description>computer model 1234 </description><quantity3</quantity><price>1234.78</price>
</item></order>
Information in an attribute
Information in body of element
2a.19
Structure of an XML document
Formally, an XML document consists of:
• an optional Prolog, and• a Root element (only one per document)
Prolog - includes instructions to specify how to process the XML document, Identified by construct <? ... ?>
Example: <?xml version="1.0" encoding="UTF-8"?>
identifies document as an XML document.
Root element - contains contents of document
2a.20
Namespace Mechanism
A mechanism of separating and identifying elements of the same name.
Widely used.
Particularly addresses problem of combining XML documents, if different documents use the same tag names to mean different things.
2a.21
Namespace identifier
• Tags combined with an additional namespace identifier to qualify it.
<name>Department of Computer Science</name><company>University of North Carolina at Charlotte</company><street> 9201 University City Blvd.</street><city>Charlotte</city><state>NC</state><postalCode>28223</postalCode>
</billTo><shipTo>
<name>Department of Computer Science</name><company> University of North Carolina at Charlotte </company><street>9201 University City Blvd.</street><city>Charlotte</city><state>NC</state><postalCode>28223</postalCode>
</shipTo><items> <item productCode=“456-CS”>
<description>computer model 1234 </description><quantity>3</quantity><price>1234.78</price>