Download presentation
Presentation is loading. Please wait.
Published byAlyson Barrett Modified over 9 years ago
1
C.1 Review of the XML Mark-Up Language © 2010 B. Wilkinson/Clayton Ferner. Spring 2010 Grid computing course. slidesC-1.ppt Modification date: Feb 26, 2010
2
Questions 1.Put your hand up if you know HTML 2.Put your hand up if you know XML (thoroughly) If yes to both, next part will be very easy and we can go quickly through it as review. C.2
3
XML Mark-Up Languages Use in Grid computing: Already seen informally in: Job description languages Globus JDD GridNexus JXPL Will shortly see in: Software Infrastructure Web Services Description Deployment C.3
4
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. C.4
5
C.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 and a matching end tag. Example Grid Computing Begin tagEnd tag Information (body)
6
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. C.6
7
C.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.
8
C.8 HTML page format Figure C.1
9
C.9 HTML Tags Tags specify details such as type of text. Example to start bold text to end bold text to start italic text to end italic text Some tags in HTML are not in pairs Line break tag New paragraph (line break + blank line)
10
C.10 HTML page Hello world My name is Tom
11
C.11 Question What does the previous HTML page display? Answer Hello World My name is Tom
12
C.12 Attributes Many tags can have attributes which specify something about the body between tag pair. Example This text is displayed in red in Times font, about 12 pt. Attributes
13
C.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.
14
C.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 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.
15
C.15
16
C.16 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.
17
C.17 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.
18
C.18 Sample XML document A purchase order
19
C.19 Example of attributes and a body computer system model 1234 1234.78 Information in an attribute Information in body of element
20
C.20 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: identifies document as an XML document. Root element - contains contents of document
21
C.21 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.
22
C.22 Namespace identifier Tags combined with an additional namespace identifier to qualify it. Namespace identifier uses URI’s (Uniform Resource Identifiers) - Web naming mechanism. URLs are a subset of URIs, and would typically be used. URI/URL need not actually exist.
23
C.23 Associating namespace identifier with local name Suppose we wish to use URL: http://www.cs.uncc.edu/~abw/ns as the namespace to be referred to by prefix myNS. Attribute in element is given as: xmlns:myNS=“http://www.cs.uncc.edu/~abw/ns”
24
C.24 Using namespace Suppose whole purchase order document earlier is to use prefix myNS, document would have form: <myNS:purchaseOrder id="53912" submitted="2004-08-05“ xmlns:myNS=“http://www.cs.uncc.edu/~abw/ns”> Department of Computer Science.. i.e. every tag would have the namespace prefix.
25
C.25 Namespace can be applied to every tag automatically if that is required without having to write a prefix, by using the attribute: xmlns =“http://www.cs.uncc.edu/~abw/ns” Using namespace throughout document without prefixes
26
C.26 Now document would have form: <purchaseOrder id="53912" submitted="2004-08-05“ xmlns=“http://www.cs.uncc.edu/~abw/ns”> Department of Computer Science.. i.e. every tag would have the namespace given. Name space given by the xmlns tag becomes default namespace unless overridden by a prefix.
27
C.27 XML Tags So far, not said what tag names and attribute names are legal in a document and how the tags are associated with a particular meaning and use. Name of tags and meaning need to be defined, just as variables given names in programs. As in programming languages, there are restrictions. Tags must start with a letter and are case sensitive.
28
C.28 XML Schema A very flexible way of handing legal tag (element) names and defining structure. An XML document with required definitions.
29
C.29 Question If tags and structure are defined in an XML document, how does one define the tags and structure in the schema XML document? Answer We use the Schema Definition Language (XSD) which has defined tags and structure. Includes data types.
30
Simple XML schema for a purchase order C.30 Fig C.4
31
C.31 Sample XML document - A purchase order Department of Computer Science University of North Carolina at Charlotte 9201 University City Blvd. Charlotte NC 28223 Department of Computer Science University of North Carolina at Charlotte 9201 University City Blvd. Charlotte NC 28223 computer system model 1234 3 1234.78
32
Schema for Purchase Order (First part) C.32
33
Schema for Purchase Order (second part) C.33
34
Schema for Purchase Order (final part) C.34
35
C.35 Associating a Schema with an instance of an XML document Fig C.5
36
C.36 Structure of documents Fig C.6
37
C.37 Schema validation Schema approach allows documents that are supposed to conform to XML syntax and a specific schema to be checked against schema, prior to processing. Two formal aspects Well-formedness – document conforms to rules of XML syntax. Validity – checks structure and identity of elements etc. that document should have from that schema.
38
C.38 What XML gives you A way of describing things which can be read by computer. Used in Web services to describe the service interface, how to deploy it, etc, (in separate XML documents. Used in the job description document to describe a job being submitted (next set of slides)
39
C.39 Sample XML documents found in the assignments
40
C.40 Job description XML document (Job Description Document JDD) Fig C.7
41
C.41 JXPL Fig C.7
42
C.42 JXPL Fig C.7 /usr/local/java/bin/java myIntegral 0 5 100000 ${GLOBUS_USER_HOME}/stdout ${GLOBUS_USER_HOME}/stderr
43
C.43 Web service deployment descriptor file (WSDD language) Fig C.8
44
Web service description file (WSDL language) C.44
45
C.45 Web service description file (First part) WSDL language <definitions name="MathService" targetNamespace="http://www.globus.org/namespaces/exa mples/core/MathService_instance" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.globus.org/namespaces/examples/ core/MathService_instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsrp="http://docs.oasis- open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2- draft-01.xsd" xmlns:wsrpw="http://docs.oasis- open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2- draft-01.wsdl" xmlns:wsdlpp="http://www.globus.org/namespaces/2004/1 0/WSDLPreprocessor" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
46
C.46 Last part <portType name="MathPortType" wsdlpp:extends="wsrpw:GetResourceProperty" wsrp:ResourceProperties="tns:MathResourceProperties"> Namespace These names defined earlier in document
47
C.47 Quiz 1.How are tags defined in HTML? Answer
48
C.48 Quiz 2.How are tags defined in XML? Answer
49
C.49 Multiple choice Quiz What is an XML schema? (a) A way to make XML documents secure (b) A way of defining XML tags (c) A way of encoding data for transmission (d) None of the other answers SAQ C-1
50
A pair of XML tags with empty contents: can be written as Under what circumstances would such a construction make sense? (a) Never (b) When there are attributes (c) When there are no attributes (d) Under any conditions C.50 SAQ C-3
51
C.51 Reference Books Several books on XML, e.g.: “Building Web Services with Java: Making sense of XML, SOAP, WSDL, and UDDI, 2nd edition” by S. Graham et al, SAMS publishing, 2004
52
C.52 Additional XML materials On-line materials W3C consortium home page: http://www.w3.org/XML/ W3Schools XML Tutorial : http://www.w3schools.com/xml/
53
2a.53 Questions
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.