extensible Markup Language (XML)

Size: px
Start display at page:

Download "extensible Markup Language (XML)"

Transcription

1 Berne University of Applied Sciences School of Engineering and Information Technology E. Benoist August-September 2006 Bibliography: java.sun.com, Collections Framework 1

2 XML Syntax Definitions Examples XML Shemas Simple element Define an Attribute XSLT - X-Path Parsing a DOM 2

3 extensible Markup Language - XML What? Markup language (like HTML) isued by the w3 consortium Contains tags: <value font="ttt" size="1"> </value> What for? For displaying pages on the web (not much). Used to communicate, configure, transfer... Base of most of the new layer 7 protocols. Example: Web Services (SOAP and WSDL). XML Syntax: Definitions 3

4 Syntax Two types of tags: Tags in two parts <value>xxx</value> Single tags <value/> Tags can contain attributes (in small letters) <value size="10" length="20"/> XML Syntax: Definitions 4

5 A very simple file <?xml version= 1.0?> <course > <title name= testname >XSL</title> <author>emmanuel Benoist</author> <forms> <subform name= 1 >Subform A</subform> <subform name= 2 >Subform B</subform> <subform name= 3 >Subform C</subform> <subform name= 4 >Subform D</subform> </forms> </course> XML Syntax: Examples 5

6 Describes the Structure of a Document Diagnostic Mister John Smith is 28 years old touch of flu. and has got a slight HTML File corresponding Mister <b>john Smith</b> is <i>28</i> years old and has got a <b>slight touch of flu</b>. This will look like : Mister John Smith is 28 years old and has got a slight touch of flu. XML Syntax: Examples 6

7 Describes the Structure of a Document (Cont.) XML File <patient> <firstname>john </firstname> <lastname> Smith </lastname> <age>28</age> <deasese level= low >flu </desease> </patient> XML Syntax: Examples 7

8 XML Documents XML File Contains the description of the data DTD File : Document Type Definition (Not used anymore) Contains the description of the format (an XML file can only have one single DTD). XML Shema XML Describing a language. One can use many shemas for one document. XSL File : extensible Stylsheet Language Contains the way the data must be presented XML Syntax: Examples 8

9 Exemple: Web Services Two XML Formats: SOAP for the messages WSDL for the Web Service Description (Meta-Language) XML Syntax: Examples 9

10 SOAP Example SOAP Request <?xml version="1.0"?> <soap:envelope xmlns:soap=" soap:encodingstyle=" <soap:body xmlns:m=" <m:getstockprice> <m:stockname>ibm</m:stockname> </m:getstockprice> </soap:body> </soap:envelope> XML Syntax: Examples 10

11 SOAP Example (Cont.) SOAP Response <?xml version="1.0"?> <soap:envelope xmlns:soap=" soap:encodingstyle=" <soap:body xmlns:m=" <m:getstockpriceresponse> <m:price>34.5</m:price> </m:getstockpriceresponse> </soap:body> </soap:envelope> XML Syntax: Examples 11

12 Web Services Description Language - WSDL <message name="gettermrequest"> <part name="term" type="xs:string"/> </message> <message name="gettermresponse"> <part name="value" type="xs:string"/> </message> <porttype name="glossaryterms"> <operation name="getterm"> <input message="gettermrequest"/> <output message="gettermresponse"/> </operation> </porttype> <binding type="glossaryterms" name="b1"> <soap:binding style="document" transport=" /> <operation> <soap:operation soapaction=" <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> XML Syntax: Examples 12

13 CML - Chemical Markup Language <cml id="c1" title="demo of cml subelements" xmlns:cmlr=" xmlns:cmls=" xmlns:stm=" <stm:dictionary dictref="d1" href="dict1.xml"/> <stm:unitlist dictref="u1" href="units1.xml"/> <cml> <molecule id="m1"/> </cml> <molecule id="m2" title="dummy"/> <stm:metadata/> <cmlr:reaction> <cmlr:reactantlist> <molecule id="r1"/> </cmlr:reactantlist> <cmlr:productlist> <molecule id="p1"/> </cmlr:productlist> </cmlr:reaction> <cmls:spectrum> <cmls:data> <stm:array/> <stm:array/> </cmls:data> </cmls:spectrum> <substancelist id="sublist1"/> <stm:list> <stm:scalar title="some scalar"/> </stm:list> </cml> XML Syntax: Examples 13

14 MathML - Mathematical Markup Language The following notation corresponds to this expression: x 2 + 4x + 4 = 0 <reln> <eq/> <apply> <plus/> <apply> <power/> <ci>x</ci> <cn>2</cn> </apply> <apply> <times/> <cn>4</cn> <ci>x</ci> </apply> <cn>4</cn> </apply> <cn>0</cn> </reln> XML Syntax: Examples 14

15 XHTML <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns=" xml:lang="en" lang="en"> <head> <title> Strict DTD XHTML Example </title> </head> <body> <p> Please Choose a Day: <br /><br /> <select name="day"> <option selected="selected">monday</option> <option>tuesday</option> <option>wednesday</option> </select> </p> </body> </html> XML Syntax: Examples 15

16 Your first DTD Document Type Definition <?xml version="1.0"?> <!DOCTYPE [ <!ELEMENT (TO, FROM, CC, SUBJECT, BODY)> <!ELEMENT TO (#PCDATA)> <!ELEMENT FROM (#PCDATA)> <!ELEMENT CC (#PCDATA)> <!ELEMENT SUBJECT (#PCDATA)> <!ELEMENT BODY (#PCDATA)> ]> < > <TO>maax@normanet.net</TO> <FROM>bie@hta-bi.bfh.ch</FROM> <CC>matth@normanet.net</CC> <SUBJECT>My First DTD</SUBJECT> <BODY>Hello, World!</BODY> </ > XML Syntax: Examples 16

17 Document Type Definition (Cont.) You can repeat elements, using Unix jockers any number, + any number but at list one? One or Zero time. <!ELEMENT (TO+, FROM, CC*, BCC*, SUBJECT?, BODY?)> Use the command!attlist to define the attributes of one TAG <!ATTLIST LANGUAGE (Western Greek Latin Universal) "Western" ENCRYPTED CDATA #IMPLIED PRIORITY (NORMAL LOW HIGH) "NORMAL"> XML Syntax: Examples 17

18 Document Type Definition (Cont.) <?xml version="1.0"?> <!DOCTYPE [ <!ELEMENT (TO+, FROM, CC*, BCC*, SUBJECT?, BODY?)> <!ATTLIST LANGUAGE (Western Greek Latin Universal) "Western" ENCRYPTED CDATA #IMPLIED PRIORITY (NORMAL LOW HIGH) "NORMAL"> <!ELEMENT TO (#PCDATA)> <!ELEMENT FROM (#PCDATA)> <!ELEMENT CC (#PCDATA)> <!ELEMENT BCC (#PCDATA)> <!ATTLIST BCC HIDDEN CDATA #FIXED "TRUE"> <!ELEMENT SUBJECT (#PCDATA)> <!ELEMENT BODY (#PCDATA)> ]>... XML Syntax: Examples 18

19 Document Type Definition (Cont.)... < LANGUAGE="Western" ENCRYPTED="128" PRIORITY="HIGH"> <SUBJECT>My Second DTD</SUBJECT> <BODY>Hello, World!</BODY> </ > XML Syntax: Examples 19

20 Document Type Definition (Cont.) The ENTITYs In XML, one can define some constants the ENTITYs. They are defined in the DTD, <!ENTITY SIGNATURE "Emmanuel"> And later used in the body of the document: <BODY> Hello, this is &SIGNATURE;. Take care, -&SIGNATURE; </BODY> XML Syntax: Examples 20

21 Document Type Definition (Cont.) <?xml version="1.0"?> <!DOCTYPE [ <!ELEMENT (TO+, FROM, CC*, BCC*, SUBJECT?, BODY?)> <!ATTLIST LANGUAGE (Western Greek Latin Universal) "Western" ENCRYPTED CDATA #IMPLIED PRIORITY (NORMAL LOW HIGH) "NORMAL"> <!ELEMENT TO (#PCDATA)> <!ELEMENT FROM (#PCDATA)> <!ELEMENT CC (#PCDATA)> <!ELEMENT BCC (#PCDATA)> <!ATTLIST BCC HIDDEN CDATA #FIXED "TRUE"> <!ELEMENT SUBJECT (#PCDATA)> <!ELEMENT BODY (#PCDATA)> <!ENTITY SIGNATURE "Emmanuel"> ]>... XML Syntax: Examples 21

22 Document Type Definition (Cont.) < LANGUAGE="Western" ENCRYPTED="128" PRIORITY="HIGH"> <SUBJECT>Sample Document with Entity References</SUBJECT> <BODY> Hello, this is &SIGNATURE;. Take care, -&SIGNATURE; </BODY> </ > XML Syntax: Examples 22

23 File : DTD in a separate File Lst4 4.dtd <?xml version="1.0"?> <!ELEMENT (TO+, FROM, CC*, BCC*, SUBJECT?, BODY?)> <!ATTLIST LANGUAGE (Western Greek Latin Universal) "Western" ENCRYPTED CDATA #IMPLIED PRIORITY (NORMAL LOW HIGH) "NORMAL"> <!ELEMENT TO (#PCDATA)> <!ELEMENT FROM (#PCDATA)> <!ELEMENT CC (#PCDATA)> <!ELEMENT BCC (#PCDATA)> <!ATTLIST BCC HIDDEN CDATA #FIXED "TRUE"> <!ELEMENT SUBJECT (#PCDATA)> <!ELEMENT BODY (#PCDATA)> <!ENTITY SIGNATURE "Emmanuel"> XML Syntax: Examples 23

24 DTD File (Cont.) You just have to declare this file in your XML document <?xml version="1.0"?> <!DOCTYPE SYSTEM "Lst4_4.dtd"> < LANGUAGE="Western" ENCRYPTED="128" PRIORITY="HIGH"> <SUBJECT>Sample Document with External DTD</SUBJECT> <BODY> Hello, this is &SIGNATURE;. Take care, -&SIGNATURE; </BODY> </ > XML Syntax: Examples 24

25 Problems with DTD One can only refere to one DTD for one document It is not possible to add self-made tags This language is not XML compatible. Solution: XML-Shemas W3C recommendation since May 2001 (originally proposed by Microsoft) XML description of a document Uses prefix and name-spaces to use different shemas. XML Schemas support data types They support namespaces XML Syntax: Examples 25

26 What is an XML Schema? It defines the legal building blocks of an XML document, just like a DTD. defines elements that can appear in a document defines attributes that can appear in a document defines which elements are child elements defines the order of child elements defines the number of child elements defines whether an element is empty or can include text defines data types for elements and attributes defines default and fixed values for elements and attributes XML Shemas 26

27 XML Schemas Support Data Types One of the greatest strength of XML Schemas is the support for data types. With support for data types: It is easier to describe allowable document content It is easier to validate the correctness of data It is easier to work with data from a database It is easier to define data facets (restrictions on data) It is easier to define data patterns (data formats) It is easier to convert data between different data types XML Shemas 27

28 A simple XML document Look at this simple XML document called note.xml : <?xml version="1.0"?> <note> <to>tove</to> <from>jani</from> <heading>reminder</heading> <body>don t forget me this weekend!</body> </note> XML Shemas 28

29 File: note.xsd An XML Shema <?xml version="1.0"?> <xs:schema xmlns:xs=" targetnamespace=" xmlns=" elementformdefault="qualified"> <xs:element name="note"> <xs:complextype> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complextype> </xs:element> </xs:schema> XML Shemas 29

30 A Reference to an XML Schema This XML document has a reference to an XML Schema: <?xml version="1.0"?> <note xmlns=" xmlns:xsi=" xsi:schemalocation=" note.xsd"> <to>tove</to> <from>jani</from> <heading>reminder</heading> <body>don t forget me this weekend!</body> </note> XML Shemas 30

31 The <schema> Element The <schema> element is the root element of every XML Schema: <?xml version="1.0"?> <xs:schema> </xs:schema> XML Shemas 31

32 The <schema> Element (Cont.) The <schema> element may contain some attributes <?xml version="1.0"?> <xs:schema xmlns:xs=" targetnamespace=" xmlns=" elementformdefault="qualified"> </xs:schema> XML Shemas 32

33 XML Shemas The <schema> Element (Cont.) The <schema> Element (Cont.) The <schema> element may contain some attributes <?xml version="1.0"?> <xs:schema xmlns:xs=" targetnamespace=" xmlns=" elementformdefault="qualified"> </xs:schema> xmlns:xs=" Means that elements and data-types used here come from this name space and will be prefixed xs. targetnamespace=" Means that elements defined here will have this namespace. xmlns=" indicates the default namespace. elementformdefault="qualified" indicates that any elements used by the XML instance document which were declared in this schema must be namespace qualified.

34 Referencing a Schema in an XML Document This XML document has a reference to an XML Schema: <?xml version="1.0"?> <note xmlns=" xmlns:xsi=" xsi:schemalocation=" note.xsd"> <to>tove</to> <from>jani</from> <heading>reminder</heading> <body>don t forget me this weekend!</body> </note> XML Shemas 34

35 XML Shemas Referencing a Schema in an XML Document Referencing a Schema in an XML Document This XML document has a reference to an XML Schema: <?xml version="1.0"?> <note xmlns=" xmlns:xsi=" xsi:schemalocation=" note.xsd"> <to>tove</to> <from>jani</from> <heading>reminder</heading> <body>don t forget me this weekend!</body> </note> xmlns=" specifies the default namespace declaration. This declaration tells the schema-validator that all the elements used in this XML document are declared in the namespace. Once you have the XML Schema Instance namespace available: xmlns:xsi=" you can use the schemalocation attribute. This attribute has two values. The first value is the namespace to use. The second value is the location of the XML schema to use for that namespace: xsi:schemalocation=" note.xsd"

36 Defining a Simple Element What is a Simple Element? A simple element is an XML element that can contain only text. It cannot contain any other elements or attributes. (the text can be of many different types, e.g. boolean, string, date, etc.) <xs:element name="xxx" type="yyy"/> XML Schema has a build in data types: xs:sting, xs:decimal, xs:integer, xs:boolean, xs:date, xs:time XML Shemas: Simple element 36

37 Example Here are some XML elements: <lastname>refsnes</lastname> <age>36</age> <dateborn> </dateborn> And here are the corresponding simple element definitions: <xs:element name="lastname" type="xs:string"/> <xs:element name="age" type="xs:integer"/> <xs:element name="dateborn" type="xs:date"/> XML Shemas: Simple element 37

38 Default and Fixed Values for Simple Elements Simple elements may have a default value OR a fixed value specified. A default value is automatically assigned to the element when no other value is specified. <xs:element name="color" type="xs:string" default="red"/> A fixed value is also automatically assigned to the element, and you cannot specify another value. <xs:element name="color" type="xs:string" fixed="red"/> XML Shemas: Simple element 38

39 How to Define an Attribute? What is an Attribute? Simple elements can not have attributes (otherwise, they are complex) <xs:attribute name="xxx" type="yyy"/> Example <lastname lang="en">smith</lastname> corresponds to the following attribute definition <xs:attribute name="lang" type="xs:string"/> XML Shemas: Define an Attribute 39

40 Default and Fixed Values for Attributes Attribute value is defined even nothing is given <xs:attribute name="lang" type="xs:string" default="en"/> A fixed value is also automatically assigned to the attribute, and you cannot specify another value. <xs:attribute name="lang" type="xs:string" fixed="en"/> XML Shemas: Define an Attribute 40

41 Optional and Required Attributes Attributes are optional by default. To specify that the attribute is required, use the use attribute: <xs:attribute name="lang" type="xs:string" use="required"/> XML Shemas: Define an Attribute 41

42 Restrictions on Values The following example defines an element called age with a restriction. The value of age cannot be lower than 0 or greater than 120: <xs:element name="age"> <xs:simpletype> <xs:restriction base="xs:integer"> <xs:mininclusive value="0"/> <xs:maxinclusive value="120"/> </xs:restriction> </xs:simpletype> </xs:element> XML Shemas: Define an Attribute 42

43 Restrictions on a Set of Values The only acceptable values are: Audi, Golf, BMW <xs:element name="car"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:enumeration value="audi"/> <xs:enumeration value="golf"/> <xs:enumeration value="bmw"/> </xs:restriction> </xs:simpletype> </xs:element> XML Shemas: Define an Attribute 43

44 Restrictions on a Set of Values (Cont.) This example could also have been written like this: <xs:element name="car" type="cartype"/> <xs:simpletype name="cartype"> <xs:restriction base="xs:string"> <xs:enumeration value="audi"/> <xs:enumeration value="golf"/> <xs:enumeration value="bmw"/> </xs:restriction> </xs:simpletype> In this case the type cartype can be used by other elements because it is not a part of the car element. XML Shemas: Define an Attribute 44

45 Restrictions on a Series of Values Accept one letter <xs:element name="letter"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:pattern value="[a-z]"/> </xs:restriction> </xs:simpletype> </xs:element> Accept three Uppercase letters <xs:element name="initials"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:pattern value="[a-z][a-z][a-z]"/> </xs:restriction> </xs:simpletype> </xs:element> XML Shemas: Define an Attribute 45

46 Restrictions on a Series of Values (Cont.) Accept 3 letters (upper- or lowercase <xs:element name="initials"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:pattern value="[a-za-z][a-za-z][a-za-z]"/> </xs:restriction> </xs:simpletype> </xs:element> XML Shemas: Define an Attribute 46

47 Restrictions on a Series of Values (Cont.) Choice: choose one of the three latters <xs:element name="choice"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:pattern value="[xyz]"/> </xs:restriction> </xs:simpletype> </xs:element> XML Shemas: Define an Attribute 47

48 Examples of Patterns The only acceptable value is FIVE digits in a sequence, and each digit must be in a range from 0 to 9: <xs:restriction base="xs:integer"> <xs:pattern value="[0-9][0-9][0-9][0-9][0-9]"/> </xs:restriction> The acceptable value is zero or more occurrences of lowercase letters from a to z: <xs:restriction base="xs:string"> <xs:pattern value="([a-z])*"/> </xs:restriction> The acceptable value is one or more pairs of letters, each pair consisting of a lower case letter followed by an upper case letter. <xs:pattern value="([a-z][a-z])+"/> XML Shemas: Define an Attribute 48

49 Examples of Patterns (Cont.) The only acceptable value is male OR female: <xs:pattern value="male female"/> There must be exactly eight characters in a row and those characters must be lowercase or uppercase letters from a to z, or a number from 0 to 9: <xs:pattern value="[a-za-z0-9]{8}"/> XML Shemas: Define an Attribute 49

50 Restrictions on Whitespace Characters To specify how whitespace characters should be handled, we would use the whitespace constraint. <xs:element name="address"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:whitespace value="preserve"/> </xs:restriction> </xs:simpletype> </xs:element> Value can be: preserve (every char remains the same) replace (tabs, CR, LF are replaced with spaces) collapse (idem + multiple spaces are collapsed) XML Shemas: Define an Attribute 50

51 Restrictions on Length The value must be exactly eight characters: <xs:element name="password"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:length value="8"/> </xs:restriction> </xs:simpletype> </xs:element> We can also use: <xs:minlength value="5"/> and <xs:maxlength value="8"/> XML Shemas: Define an Attribute 51

52 XSD Complex Elements A complex element contains other elements and/or attributes. There are four kinds of complex elements: empty elements elements that contain only other elements elements that contain only text elements that contain both other elements and text Each of these elements may contain attributes as well! XML Shemas: Define an Attribute 52

53 Examples of Complex Elements A complex XML element, product, which is empty: <product pid="1345"/> A complex XML element, employee, which contains only other elements: <employee> <firstname>john</firstname> <lastname>smith</lastname> </employee> A complex XML element, food, which contains only text: <food type="dessert">ice cream</food> A complex XML element, description, which contains both elements and text: <description> It happened on <date lang="norwegian"> </date>... </description> XML Shemas: Define an Attribute 53

54 How to Define a Complex Element Look at this complex XML element, employee <employee> <firstname>john</firstname> <lastname>smith</lastname> </employee> 1) The employee element can be declared directly by naming the element, like this: <xs:element name="employee"> <xs:complextype> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 54

55 How to Define a Complex Element (Cont.) 2) The employee element can have a type attribute that refers to the name of the complex type to use: <xs:element name="employee" type="personinfo"/> <xs:complextype name="personinfo"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complextype> Can be refered to by many elements <xs:element name="employee" type="personinfo"/> <xs:element name="student" type="personinfo"/> <xs:element name="member" type="personinfo"/> XML Shemas: Define an Attribute 55

56 More complex: <xs:element name="employee" type="fullpersoninfo"/> <xs:complextype name="personinfo"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complextype> <xs:complextype name="fullpersoninfo"> <xs:complexcontent> <xs:extension base="personinfo"> <xs:sequence> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> XML Shemas: Define an Attribute 56

57 Complex Empty Elements Like : <product prodid="1345" /> <xs:element name="product"> <xs:complextype> <xs:complexcontent> <xs:restriction base="xs:integer"> <xs:attribute name="prodid" type="xs:positiveinteger"/> </xs:restriction> </xs:complexcontent> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 57

58 Complex Empty Elements (Cont.) or a more compact definition: <xs:element name="product"> <xs:complextype> <xs:attribute name="prodid" type="xs:positiveinteger"/> </xs:complextype> </xs:element> or even <xs:element name="product" type="prodtype"/> <xs:complextype name="prodtype"> <xs:attribute name="prodid" type="xs:positiveinteger"/> </xs:complextype> XML Shemas: Define an Attribute 58

59 Complex Types Containing Elements Only <xs:element name="person"> <xs:complextype> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 59

60 Complex Text-Only Elements <xs:element name="somename"> <xs:complextype> <xs:simplecontent> <xs:extension base="basetype"> </xs:extension> </xs:simplecontent> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 60

61 Complex Text-Only Elements (Cont.) Or <xs:element name="somename"> <xs:complextype> <xs:simplecontent> <xs:restriction base="basetype"> </xs:restriction> </xs:simplecontent> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 61

62 Example Shoe size <shoesize country="france">35</shoesize> <xs:element name="shoesize"> <xs:complextype> <xs:simplecontent> <xs:extension base="xs:integer"> <xs:attribute name="country" type="xs:string" /> </xs:extension> </xs:simplecontent> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 62

63 Complex Types with Mixed Content <xs:element name="letter"> <xs:complextype mixed="true"> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="orderid" type="xs:positiveinteger"/ <xs:element name="shipdate" type="xs:date"/> </xs:sequence> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 63

64 XSD Complex Types Indicators Indicators There are seven indicators Order indicators: All, Choice, Sequence Occurrence indicators: maxoccurs, minoccurs Group indicators: Group name, attributegroup name Example for order indicator <xs:element name="person"> <xs:complextype> <xs:all> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:all> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 64

65 XSD Complex Types Indicators Sequence Indicator The <sequence> indicator specifies that the child elements must appear in a specific order: <xs:element name="person"> <xs:complextype> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 65

66 Group Indicators Element Groups You must define an all, choice, or sequence element inside the group declaration. After you have defined a group, you can reference it in another definition, like this: <xs:group name="persongroup"> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:element name="birthday" type="xs:date"/> </xs:sequence> </xs:group> <xs:element name="person" type="personinfo"/> <xs:complextype name="personinfo"> <xs:sequence> <xs:group ref="persongroup"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complextype> XML Shemas: Define an Attribute 66

67 Attribute Groups Attribute groups are defined with the attributegroup declaration, like this: <xs:attributegroup name="personattrgroup"> <xs:attribute name="firstname" type="xs:string"/> <xs:attribute name="lastname" type="xs:string"/> <xs:attribute name="birthday" type="xs:date"/> </xs:attributegroup> <xs:element name="person"> <xs:complextype> <xs:attributegroup ref="personattrgroup"/> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 67

68 Attribute Groups (Cont.) Attribute groups are defined with the attributegroup declaration, like this: If we have a file creating a children tag, we can use it: <?xml version="1.0" encoding="iso "?> <persons xmlns=" xmlns:xsi=" xsi:schemalocation=" family.xsd children.xsd"> <person> <firstname>hege</firstname> <lastname>refsnes</lastname> <children> <childname>cecilie</childname> </children> </person> <person> <firstname>stale</firstname> <lastname>refsnes</lastname> </person> </persons> XML Shemas: Define an Attribute 68

69 The <anyattribute> Element The <anyattribute> element enables us to extend the XML document with attributes not specified by the schema! <xs:element name="person"> <xs:complextype> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> </xs:sequence> <xs:anyattribute/> </xs:complextype> </xs:element> XML Shemas: Define an Attribute 69

70 The <attribute> Element Suppose we have the other following shema attribute.xsd <?xml version="1.0" encoding="iso "?> <xs:schema xmlns:xs=" targetnamespace=" xmlns=" elementformdefault="qualified"> <xs:attribute name="gender"> <xs:simpletype> <xs:restriction base="xs:string"> <xs:pattern value="male female"/> </xs:restriction> </xs:simpletype> </xs:attribute> </xs:schema> XML Shemas: Define an Attribute 70

71 The <attribute> Element (Cont.) We can have the following xml content <?xml version="1.0" encoding="iso "?> <persons xmlns=" xmlns:xsi=" xsi:schemalocation=" family.xsd attribute.xsd"> <person gender="female"> <firstname>hege</firstname> <lastname>refsnes</lastname> </person> <person gender="male"> <firstname>stale</firstname> <lastname>refsnes</lastname> </person> </persons> XML Shemas: Define an Attribute 71

72 Element Substitution Suppose we want to have an element name that can be substituated by another element navn <xs:element name="name" type="xs:string"/> <xs:element name="navn" substitutiongroup="name"/> <xs:complextype name="custinfo"> <xs:sequence> <xs:element ref="name"/> </xs:sequence> </xs:complextype> <xs:element name="customer" type="custinfo"/> <xs:element name="kunde" substitutiongroup="customer"/> Corresponding XML document: <customer> <name>john Smith</name> </customer> OR <kunde> <navn>john Smith</navn> </kunde> XML Shemas: Define an Attribute 72

73 XSD Example XML document called shiporder.xml : <?xml version="1.0" encoding="iso "?> <shiporder orderid="889923" xmlns:xsi=" xsi:nonamespaceschemalocation="shiporder.xsd"> <orderperson>john Smith</orderperson> <shipto> <name>ola Nordmann</name> <address>langgt 23</address> <city>4000 Stavanger</city> <country>norway</country> </shipto> <item> <title>empire Burlesque</title> <note>special Edition</note> <quantity>1</quantity> <price>10.90</price> </item> <item> <title>hide your heart</title> <quantity>1</quantity> <price>9.90</price> </item> </shiporder> XML Shemas: Define an Attribute 73

74 Corresponding Schema <?xml version="1.0" encoding="iso "?> <xs:schema xmlns:xs=" <xs:simpletype name="stringtype"> <xs:restriction base="xs:string"/> </xs:simpletype> <xs:simpletype name="inttype"> <xs:restriction base="xs:positiveinteger"/> </xs:simpletype> <xs:simpletype name="dectype"> <xs:restriction base="xs:decimal"/> </xs:simpletype> <xs:simpletype name="orderidtype"> <xs:restriction base="xs:string"> <xs:pattern value="[0-9]{6}"/> </xs:restriction> </xs:simpletype>... XML Shemas: Define an Attribute 74

75 Corresponding Schema (Cont.)... <xs:complextype name="shiptotype"> <xs:sequence> <xs:element name="name" type="stringtype"/> <xs:element name="address" type="stringtype"/> <xs:element name="city" type="stringtype"/> <xs:element name="country" type="stringtype"/> </xs:sequence> </xs:complextype> <xs:complextype name="itemtype"> <xs:sequence> <xs:element name="title" type="stringtype"/> <xs:element name="note" type="stringtype" minoccurs="0"/> <xs:element name="quantity" type="inttype"/> <xs:element name="price" type="dectype"/> </xs:sequence> </xs:complextype>... XML Shemas: Define an Attribute 75

76 Corresponding Schema (Cont.)... <xs:complextype name="shipordertype"> <xs:sequence> <xs:element name="orderperson" type="stringtype"/> <xs:element name="shipto" type="shiptotype"/> <xs:element name="item" maxoccurs="unbounded" type="itemtype"/> </xs:sequence> <xs:attribute name="orderid" type="orderidtype" use="required"/> </xs:complextype> <xs:element name="shiporder" type="shipordertype"/> </xs:schema> XML Shemas: Define an Attribute 76

77 XML Shemas: Define an Attribute 77

78 XML Shemas: Define an Attribute 78

79 XML Shemas: Define an Attribute 79

80 XML Shemas: Define an Attribute 80

81 Browser PDA (Palm-pilot, Psion, Win CE...) GSM Vocal application (for blind people) Parsing a DOM 81

82 extensible Stylsheet Language Explain how a XML document will look like XML File : <?xml version="1.0"?> <xsltutorial > <title>xsl</title> <author>john Smith</author> </xsltutorial> XSL File : <xsl:stylesheet xmlns:xsl= > <xsl:template match="/"> <H1><xsl:value-of select="//title"/></h1> <H2><xsl:value-of select="//author"/></h2> </xsl:template> </xsl:stylesheet> Parsing a DOM 82

83 Syntax Every XSL stylesheet must start with xsl:stylesheet element. The atribute xmlns:xsl specifies version of XSL(T) specification. This example shows the simplest possible stylesheet. As it does not contain any information, default processing is used. <xsl:stylesheet xmlns:xsl= > </xsl:stylesheet> An XSL processors parses an XML source and tries to find a matching template rule. If it does, instructions inside matching template are evaluated. <xsl:stylesheet xmlns:xsl= > <xsl:template match="bold"> <P><B><xsl:value-of select="."/></b></p> </xsl:template> <xsl:template match="red"> Parsing a DOM 83

84 XSL (Cont.) Contents of original elements can be recovered from original sources in two basic ways. Example below uses xsl:value-of construct. In this case the contents of the element is used without any further processing. This XSL StyleSheet <xsl:stylesheet xmlns:xsl= > <xsl:template match="employee"> <B><xsl:value-of select="."/></b> </xsl:template> <xsl:template match="surname"> <i><xsl:value-of select="."/></i> </xsl:template> </xsl:stylesheet> With this XML file <?xml version="1.0"?> Parsing a DOM 84

85 XSL (Cont.) The second way to deal with value is to use xsl:apply-templates <xsl:stylesheet xmlns:xsl= > <xsl:template match="employee"> <B><xsl:apply-templates select="firstname"/></b> <B><xsl:apply-templates select="surname"/></b> </xsl:template> <xsl:template match="surname"> <i> <xsl:value-of select="."/></i> </xsl:template> </xsl:stylesheet> Will give (on the same xml file) <B>Joe</B> <B> Parsing a DOM 85

86 Conclusion : XML Adventages Very convenient to modelize data Easy to parse Transfer of information between processus, programs or computers Disadventages Only implemented in Netscape 6 and IE5 (can not read the RFC in XML), Not designed for displaying on the Web, more for exchanging informations, Parsing a DOM 86

87 Exercise We want to modelize the flights of Swiss. A file will regroup informations on many flights. A flight contains a departure, an arrival and maybe one ore more vias. Any point on the way (departure vias and arrival) can be modelized as three data: the name of the airport (we will use entities to represent internationnal airports), the date and the time. Parsing a DOM 87

88 Solution (XML) <flightlist> <flight> <departure> <point> <airport> &ZHR; </airport> <date> July </date> <hour>10h00</hour> </point></departure> <via> <point> <airport> &CDG; </airport> <date> July </date> <hour>11h00</hour> </point></via> <arrival> <point> <airport>&jfk; </airport> <date> July </date> extensible <hour> Markup Language 14h00</hour> (XML) </point></arrival> Parsing a DOM 88

89 Solution DTD <!ELEMENT flightlist (flight+)> <!ELEMENT flight (departure, via*, arrival)> <!ELEMENT departure (point)> <!ELEMENT arrival (point)> <!ELEMENT via (point)> <!ELEMENT point (airport, date, hour)> <!ELEMENT airport (#PCDATA)> <!ELEMENT date (#PCDATA)> <!ELEMENT hour (#PCDATA)> <!ENTITY CDG "Roissy Charles De Gaule"> <!ENTITY JFK "John Fitzgerald kennedy"> <!ENTITY ZHR "Zurich Kloten"> Parsing a DOM 89

90 // validate the DOM tree Parsing a DOM 90 Exercice validation/package-summary.html // parse an XML document into a DOM tree DocumentBuilder parser = DocumentBuilderFactory.newInst Document document = parser.parse(new File("instance.xml // create a SchemaFactory capable of understanding WXS SchemaFactory factory = SchemaFactory.newInstance(XMLCo // load a WXS schema, represented by a Schema instance Source schemafile = new StreamSource(new File("mySchema Schema schema = factory.newschema(schemafile); // create a Validator instance, which can be used to va Validator validator = schema.newvalidator();

Introduction to XML Schema. The XML Schema language is also referred to as XML Schema Definition (XSD).

Introduction to XML Schema. The XML Schema language is also referred to as XML Schema Definition (XSD). Introduction to XML Schema XML Schema is an XML-based alternative to DTD. An XML schema describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition

More information

Markup Languages. Lecture 4. XML Schema

Markup Languages. Lecture 4. XML Schema Markup Languages Lecture 4. XML Schema Introduction to XML Schema XML Schema is an XML-based alternative to DTD. An XML schema describes the structure of an XML document. The XML Schema language is also

More information

XML extensible Markup Language

XML extensible Markup Language extensible Markup Language Eshcar Hillel Sources: http://www.w3schools.com http://java.sun.com/webservices/jaxp/ learning/tutorial/index.html Tutorial Outline What is? syntax rules Schema Document Object

More information

Software Engineering Methods, XML extensible Markup Language. Tutorial Outline. An Example File: Note.xml XML 1

Software Engineering Methods, XML extensible Markup Language. Tutorial Outline. An Example File: Note.xml XML 1 extensible Markup Language Eshcar Hillel Sources: http://www.w3schools.com http://java.sun.com/webservices/jaxp/ learning/tutorial/index.html Tutorial Outline What is? syntax rules Schema Document Object

More information

X(ml)S(chema)D(definition) Complex Types Indicators

X(ml)S(chema)D(definition) Complex Types Indicators X(ml)S(chema)D(definition) Complex Types Indicators We can control HOW elements are to be used in documents with indicators. Indicators We have seven types of indicators: Order indicators: All Choice Sequence

More information

Notes. Any feedback/suggestions? IS 651: Distributed Systems

Notes. Any feedback/suggestions? IS 651: Distributed Systems Notes Grading statistics Midterm1: average 10.60 out of 15 with stdev 2.22 Total: average 15.46 out of 21 with stdev 2.80 A range: [18.26, 23] B range: [12.66, 18.26) C or worse range: [0, 12.66) The curve

More information

MANAGING INFORMATION (CSCU9T4) LECTURE 2: XML STRUCTURE

MANAGING INFORMATION (CSCU9T4) LECTURE 2: XML STRUCTURE MANAGING INFORMATION (CSCU9T4) LECTURE 2: XML STRUCTURE Gabriela Ochoa http://www.cs.stir.ac.uk/~goc/ OUTLINE XML Elements vs. Attributes Well-formed vs. Valid XML documents Document Type Definitions (DTDs)

More information

Tecnologie per XML. Sara Comai Politecnico di Milano. Tecnologie legate a XML

Tecnologie per XML. Sara Comai Politecnico di Milano. Tecnologie legate a XML Tecnologie per XML Sara Comai Politecnico di Milano Tecnologie legate a XML DTD XHTML: riformulazione di HTML in XML Namespaces CSS: style sheets per visualizzare documenti XML XSD: XML schema XLink: linguaggio

More information

extensible Markup Language

extensible Markup Language What is XML? The acronym means extensible Markup Language It is used to describe data in a way which is simple, structured and (usually) readable also by humans Developed at the end of the ninenties by

More information

extensible Markup Language

extensible Markup Language What is XML? The acronym means extensible Markup Language It is used to describe data in a way which is simple, structured and (usually) readable also by humans Developed at the end of the ninenties by

More information

XML (Extensible Markup Language)

XML (Extensible Markup Language) Basics of XML: What is XML? XML (Extensible Markup Language) XML stands for Extensible Markup Language XML was designed to carry data, not to display data XML tags are not predefined. You must define your

More information

27/02/2013. XML Schema. Nội dung. 1. Giới thiệu. XML Schema hỗ trợ các kiểu dữ liệu. Giới thiệu Các kiểu ñơn giản Các kiểu phức tạp Kiểu dữ liệu

27/02/2013. XML Schema. Nội dung. 1. Giới thiệu. XML Schema hỗ trợ các kiểu dữ liệu. Giới thiệu Các kiểu ñơn giản Các kiểu phức tạp Kiểu dữ liệu Nội dung XML Schema Nguyễn Hồng Phương Email: phuong.nguyenhong@hust.edu.vn Site: http://is.hut.edu.vn/~phuongnh Bộ môn Hệ thống thông tin Viện Công nghệ thông tin và Truyền thông Đại học Bách Khoa Hà

More information

Semantic Web. XML and XML Schema. Morteza Amini. Sharif University of Technology Fall 94-95

Semantic Web. XML and XML Schema. Morteza Amini. Sharif University of Technology Fall 94-95 ه عا ی Semantic Web XML and XML Schema Morteza Amini Sharif University of Technology Fall 94-95 Outline Markup Languages XML Building Blocks XML Applications Namespaces XML Schema 2 Outline Markup Languages

More information

Agenda. XML document Structure. XML and HTML were designed with different goals: XML was designed to describe data and to focus on what

Agenda. XML document Structure. XML and HTML were designed with different goals: XML was designed to describe data and to focus on what XML extensible Markup Language Reda Bendraou Reda.Bendraou@lip6.fr http://pagesperso-systeme.lip6.fr/reda.bendraou Agenda Part I : The XML Standard Goals Why XML? XML document Structure Well-formed XML

More information

Ontologies and Schema Languages on the Web. Kaveh Shahbaz

Ontologies and Schema Languages on the Web. Kaveh Shahbaz Ontologies and Schema Languages on the Web Kaveh Shahbaz 83700805 K_Shahbaz@ce.sharif.edu Outline Abstract Introduction of ontologies and schemas and relations XML schema and ontology Language RDF schema

More information

but XML goes far beyond HTML: it describes data

but XML goes far beyond HTML: it describes data The XML Meta-Language 1 Introduction to XML The father of markup languages: XML = EXtensible Markup Language is a simplified version of SGML Originally created to overcome the limitations of HTML the HTML

More information

XML and Web Services

XML and Web Services XML and Web Services Lecture 8 1 XML (Section 17) Outline XML syntax, semistructured data Document Type Definitions (DTDs) XML Schema Introduction to XML based Web Services 2 Additional Readings on XML

More information

markup language carry data define your own tags self-descriptive W3C Recommendation

markup language carry data define your own tags self-descriptive W3C Recommendation XML intro What is XML? XML stands for EXtensible Markup Language XML is a markup language much like HTML XML was designed to carry data, not to display data XML tags are not predefined. You must define

More information

Introduction Syntax and Usage XML Databases Java Tutorial XML. November 5, 2008 XML

Introduction Syntax and Usage XML Databases Java Tutorial XML. November 5, 2008 XML Introduction Syntax and Usage Databases Java Tutorial November 5, 2008 Introduction Syntax and Usage Databases Java Tutorial Outline 1 Introduction 2 Syntax and Usage Syntax Well Formed and Valid Displaying

More information

SOA and Webservices. Lena Buffoni

SOA and Webservices. Lena Buffoni SOA and Webservices Lena Buffoni APRIL 13, 2016 2 Concept of SOA A collection of services that communicate and coordinate with each other APRIL 13, 2016 3 APRIL 12, 2016 4 SOA principles APRIL 13, 2016

More information

Restricting complextypes that have mixed content

Restricting complextypes that have mixed content Restricting complextypes that have mixed content Roger L. Costello October 2012 complextype with mixed content (no attributes) Here is a complextype with mixed content:

More information

Internet Technologies 11-XML. F. Ricci 2010/2011

Internet Technologies 11-XML. F. Ricci 2010/2011 Internet Technologies 11-XML F. Ricci 2010/2011 Content Motivation Examples Applications Elements, Prologue, Document Type Definition Attributes Well-formedness XML and CSS Document Type Definition and

More information

XML/XHTML. ESA 2015/2016 Adam Belloum Material Prepared by Eelco Schatborn

XML/XHTML. ESA 2015/2016 Adam Belloum Material Prepared by Eelco Schatborn XML/XHTML ESA 2015/2016 Adam Belloum a.s.z.belloum@uva.nl Material Prepared by Eelco Schatborn 1 Announcements +++ Feedback assignments Exactly one week to finish the assignment (deadlines Midnight Sundays

More information

XML Schema. Mario Alviano A.Y. 2017/2018. University of Calabria, Italy 1 / 28

XML Schema. Mario Alviano A.Y. 2017/2018. University of Calabria, Italy 1 / 28 1 / 28 XML Schema Mario Alviano University of Calabria, Italy A.Y. 2017/2018 Outline 2 / 28 1 Introduction 2 Elements 3 Simple and complex types 4 Attributes 5 Groups and built-in 6 Import of other schemes

More information

Languages of the WEB. Jukka K. Nurminen

Languages of the WEB. Jukka K. Nurminen Languages of the WEB Jukka K. Nurminen 14.1.2013 Prac%cali%es Last %me Prac%cali%es + Introduc%on Slides available in Noppa Some of the visi%ng lectures s%ll not confirmed Assignments Remember to signup

More information

Introducing our First Schema

Introducing our First Schema 1 di 11 21/05/2006 10.24 Published on XML.com http://www.xml.com/pub/a/2000/11/29/schemas/part1.html See this if you're having trouble printing code examples Using W3C XML By Eric van der Vlist October

More information

XML Extensible Markup Language

XML Extensible Markup Language XML Extensible Markup Language Generic format for structured representation of data. DD1335 (Lecture 9) Basic Internet Programming Spring 2010 1 / 34 XML Extensible Markup Language Generic format for structured

More information

World-Wide Wide Web. Netprog HTTP

World-Wide Wide Web. Netprog HTTP Web Services Based partially on Sun Java Tutorial at http://java.sun.com/webservices/ Also, XML, Java and the Future of The Web, Jon Bosak. And WSDL Tutorial at: http://www.w3schools.com/wsdl wsdl/ 1 World-Wide

More information

Introduction to XML. M2 MIA, Grenoble Université. François Faure

Introduction to XML. M2 MIA, Grenoble Université. François Faure M2 MIA, Grenoble Université Example tove jani reminder dont forget me this weekend!

More information

XML: extensible Markup Language

XML: extensible Markup Language XML: extensible Markup Language Languages fr web SisInf Lab - Plytechnic University f Bari Master s Degree Curse in Cmputer Engineering What is XML? XML is a subset f SGML aiming t enable generic dcument

More information

So far, we've discussed the use of XML in creating web services. How does this work? What other things can we do with it?

So far, we've discussed the use of XML in creating web services. How does this work? What other things can we do with it? XML Page 1 XML and web services Monday, March 14, 2011 2:50 PM So far, we've discussed the use of XML in creating web services. How does this work? What other things can we do with it? XML Page 2 Where

More information

Web Computing. Revision Notes

Web Computing. Revision Notes Web Computing Revision Notes Exam Format The format of the exam is standard: Answer TWO OUT OF THREE questions Candidates should answer ONLY TWO questions The time allowed is TWO hours Notes: You will

More information

Big Data Exercises. Fall 2018 Week 8 ETH Zurich. XML validation

Big Data Exercises. Fall 2018 Week 8 ETH Zurich. XML validation Big Data Exercises Fall 2018 Week 8 ETH Zurich XML validation Reading: (optional, but useful) XML in a Nutshell, Elliotte Rusty Harold, W. Scott Means, 3rd edition, 2005: Online via ETH Library 1. XML

More information

:38:00 1 / 14

:38:00 1 / 14 In this course you will be using XML Editor version 12.3 (oxygen for short from now on) for XML related work. The work includes writing XML Schema files with corresponding XML files, writing

More information

XML. Document Type Definitions XML Schema. Database Systems and Concepts, CSCI 3030U, UOIT, Course Instructor: Jarek Szlichta

XML. Document Type Definitions XML Schema. Database Systems and Concepts, CSCI 3030U, UOIT, Course Instructor: Jarek Szlichta XML Document Type Definitions XML Schema 1 XML XML stands for extensible Markup Language. XML was designed to describe data. XML has come into common use for the interchange of data over the Internet.

More information

Syntax XML Schema XML Techniques for E-Commerce, Budapest 2004

Syntax XML Schema XML Techniques for E-Commerce, Budapest 2004 Mag. iur. Dr. techn. Michael Sonntag Syntax XML Schema XML Techniques for E-Commerce, Budapest 2004 E-Mail: sonntag@fim.uni-linz.ac.at http://www.fim.uni-linz.ac.at/staff/sonntag.htm Michael Sonntag 2004

More information

A) XML Separates Data from HTML

A) XML Separates Data from HTML UNIT I XML benefits Advantages of XML over HTML, EDI, Databases XML based standards Structuring with schemas - DTD XML Schemas XML processing DOM SAX presentation technologies XSL XFORMS XHTML Transformation

More information

Java EE 7: Back-end Server Application Development 4-2

Java EE 7: Back-end Server Application Development 4-2 Java EE 7: Back-end Server Application Development 4-2 XML describes data objects called XML documents that: Are composed of markup language for structuring the document data Support custom tags for data

More information

Big Data 9. Data Models

Big Data 9. Data Models Ghislain Fourny Big Data 9. Data Models pinkyone / 123RF Stock Photo 1 Syntax vs. Data Models Physical view Syntax this is text. 2 Syntax vs. Data Models a Logical view

More information

CountryData Technologies for Data Exchange. Introduction to XML

CountryData Technologies for Data Exchange. Introduction to XML CountryData Technologies for Data Exchange Introduction to XML What is XML? EXtensible Markup Language Format is similar to HTML, but XML deals with data structures, while HTML is about presentation Open

More information

The main problem of DTD s...

The main problem of DTD s... The main problem of DTD s... They are not written in XML! Solution: Another XML-based standard: XML Schema For more info see: http://www.w3.org/xml/schema XML Schema (W3C) Thanks to Jussi Pohjolainen TAMK

More information

Last week we saw how to use the DOM parser to read an XML document. The DOM parser can also be used to create and modify nodes.

Last week we saw how to use the DOM parser to read an XML document. The DOM parser can also be used to create and modify nodes. Distributed Software Development XML Schema Chris Brooks Department of Computer Science University of San Francisco 7-2: Modifying XML programmatically Last week we saw how to use the DOM parser to read

More information

What is XML? XML is designed to transport and store data.

What is XML? XML is designed to transport and store data. What is XML? XML stands for extensible Markup Language. XML is designed to transport and store data. HTML was designed to display data. XML is a markup language much like HTML XML was designed to carry

More information

Introduction & Motivation. Course Outline. Arrangements. Presentation vs Structure. Markup and Markup Language. Main Topic: Two XML Query Models

Introduction & Motivation. Course Outline. Arrangements. Presentation vs Structure. Markup and Markup Language. Main Topic: Two XML Query Models Querying XML Documents and Data CBU Summer School 13.8. - 20.8.2007 (2 ECTS) Prof. Pekka Kilpeläinen inen Univ of Kuopio, Dept of Computer Science Pekka.Kilpelainen@cs.uku.fi Introduction & Motivation

More information

XML Schema Element and Attribute Reference

XML Schema Element and Attribute Reference E XML Schema Element and Attribute Reference all This appendix provides a full listing of all elements within the XML Schema Structures Recommendation (found at http://www.w3.org/tr/xmlschema-1/). The

More information

Appendix H XML Quick Reference

Appendix H XML Quick Reference HTML Appendix H XML Quick Reference What Is XML? Extensible Markup Language (XML) is a subset of the Standard Generalized Markup Language (SGML). XML allows developers to create their own document elements

More information

Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013

Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013 Extensible Markup Language (XML) Hamid Zarrabi-Zadeh Web Programming Fall 2013 2 Outline Introduction XML Structure Document Type Definition (DTD) XHMTL Formatting XML CSS Formatting XSLT Transformations

More information

XML. Objectives. Duration. Audience. Pre-Requisites

XML. Objectives. Duration. Audience. Pre-Requisites XML XML - extensible Markup Language is a family of standardized data formats. XML is used for data transmission and storage. Common applications of XML include business to business transactions, web services

More information

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science. Date: Tuesday 20 th May 2008.

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science. Date: Tuesday 20 th May 2008. COMP60370 Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE M.Sc. in Advanced Computer Science Semi-Structured Data and the Web Date: Tuesday 20 th May 2008 Time: 09:45 11:45 Please answer

More information

Solution Sheet 5 XML Data Models and XQuery

Solution Sheet 5 XML Data Models and XQuery The Systems Group at ETH Zurich Big Data Fall Semester 2012 Prof. Dr. Donald Kossmann Prof. Dr. Nesime Tatbul Assistants: Martin Kaufmann Besmira Nushi 07.12.2012 Solution Sheet 5 XML Data Models and XQuery

More information

Introduction to XML DTD

Introduction to XML DTD Introduction to XML DTD What is a DTD? A DTD is usually a file (or several files to be used together) which contains a formal definition of a particular type of document. This sets out what names can be

More information

Web Services. The Pervasive Internet

Web Services. The Pervasive Internet Web Services CPSC 328 Spring 2009 The Pervasive Internet Years ago, computers couldn t talk to each other like they can now Researchers wanted to share information The Internet! Gopher & Veronica (text

More information

All About <xml> CS193D, 2/22/06

All About <xml> CS193D, 2/22/06 CS193D Handout 17 Winter 2005/2006 February 21, 2006 XML See also: Chapter 24 (709-728) All About CS193D, 2/22/06 XML is A markup language, but not really a language General purpose Cross-platform

More information

Session 23 XML. XML Reading and Reference. Reading. Reference: Session 23 XML. Robert Kelly, 2018

Session 23 XML. XML Reading and Reference. Reading. Reference: Session 23 XML. Robert Kelly, 2018 Session 23 XML Reading XML Reading and Reference https://en.wikipedia.org/wiki/xml Reference: XML in a Nutshell (Ch. 1-3), available in Safari On-line 2 1 Lecture Objectives Understand the goal of application

More information

Messages are securely encrypted using HTTPS. HTTPS is the most commonly used secure method of exchanging data among web browsers.

Messages are securely encrypted using HTTPS. HTTPS is the most commonly used secure method of exchanging data among web browsers. May 6, 2009 9:39 SIF Specifications SIF Implementation Specification The SIF Implementation Specification is based on the World Wide Web Consortium (W3C) endorsed Extensible Markup Language (XML) which

More information

Big Data Fall Data Models

Big Data Fall Data Models Ghislain Fourny Big Data Fall 2018 11. Data Models pinkyone / 123RF Stock Photo CSV (Comma separated values) This is syntax ID,Last name,first name,theory, 1,Einstein,Albert,"General, Special Relativity"

More information

Data formats. { "firstname": "John", "lastname" : "Smith", "age" : 25, "address" : { "streetaddress": "21 2nd Street",

Data formats. { firstname: John, lastname : Smith, age : 25, address : { streetaddress: 21 2nd Street, Data formats { "firstname": "John", "lastname" : "Smith", "age" : 25, "address" : { "streetaddress": "21 2nd Street", "city" : "New York", "state" : "NY", "postalcode" : "10021" }, CSCI 470: Web Science

More information

Structured documents

Structured documents Structured documents An overview of XML Structured documents Michael Houghton 15/11/2000 Unstructured documents Broadly speaking, text and multimedia document formats can be structured or unstructured.

More information

Information Systems. DTD and XML Schema. Nikolaj Popov

Information Systems. DTD and XML Schema. Nikolaj Popov Information Systems DTD and XML Schema Nikolaj Popov Research Institute for Symbolic Computation Johannes Kepler University of Linz, Austria popov@risc.uni-linz.ac.at Outline DTDs Document Type Declarations

More information

COMP60411 Modelling Data on the Web XPath, XML Schema, and XQuery, week 3

COMP60411 Modelling Data on the Web XPath, XML Schema, and XQuery, week 3 COMP60411 Modelling Data on the Web XPath, XML Schema, and XQuery, week 3 Bijan Parsia Uli Sattler University of Manchester 1 Week 1 coursework Mostly graded! Q1, SE1, M1 should be accessible to you CW1

More information

PESC Compliant JSON Version /19/2018. A publication of the Technical Advisory Board Postsecondary Electronic Standards Council

PESC Compliant JSON Version /19/2018. A publication of the Technical Advisory Board Postsecondary Electronic Standards Council Version 0.5.0 10/19/2018 A publication of the Technical Advisory Board Postsecondary Electronic Standards Council 2018. All Rights Reserved. This document may be copied and furnished to others, and derivative

More information

Introduction to XML (Extensible Markup Language)

Introduction to XML (Extensible Markup Language) Introduction to XML (Extensible Markup Language) 1 History and References XML is a meta-language, a simplified form of SGML (Standard Generalized Markup Language) XML was initiated in large parts by Jon

More information

[MS-OXWSSYNC]: Mailbox Contents Synchronization Web Service Protocol Specification

[MS-OXWSSYNC]: Mailbox Contents Synchronization Web Service Protocol Specification [MS-OXWSSYNC]: Mailbox Contents Synchronization Web Service Protocol Specification Intellectual Property Rights Notice for Open Specifications Documentation Technical Documentation. Microsoft publishes

More information

XML for Android Developers. partially adapted from XML Tutorial by W3Schools

XML for Android Developers. partially adapted from XML Tutorial by W3Schools XML for Android Developers partially adapted from XML Tutorial by W3Schools Markup Language A system for annotating a text document in way that is syntactically distinguishble from the content. Motivated

More information

COMP60411 Modelling Data on the Web XPath, XML Schema, and XQuery. Week 3

COMP60411 Modelling Data on the Web XPath, XML Schema, and XQuery. Week 3 COMP60411 Modelling Data on the Web XPath, XML Schema, and XQuery Week 3 Bijan Parsia Uli Sattler University of Manchester Week 1 coursework All graded! Q1, SE1, M1, CW1 In general, Pay attention to the

More information

Overview. Introduction. Introduction XML XML. Lecture 16 Introduction to XML. Boriana Koleva Room: C54

Overview. Introduction. Introduction XML XML. Lecture 16 Introduction to XML. Boriana Koleva Room: C54 Overview Lecture 16 Introduction to XML Boriana Koleva Room: C54 Email: bnk@cs.nott.ac.uk Introduction The Syntax of XML XML Document Structure Document Type Definitions Introduction Introduction SGML

More information

Week 5 Aim: Description. Source Code

Week 5 Aim: Description. Source Code Week 5 Aim: Write an XML file which will display the Book information which includes the following: 1) Title of the book 2) Author Name 3) ISBN number 4) Publisher name 5) Edition 6) Price Write a Document

More information

7.1 Introduction. extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML

7.1 Introduction. extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML 7.1 Introduction extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML Lax syntactical rules Many complex features that are rarely used HTML is a markup language,

More information

Big Data for Engineers Spring Data Models

Big Data for Engineers Spring Data Models Ghislain Fourny Big Data for Engineers Spring 2018 11. Data Models pinkyone / 123RF Stock Photo CSV (Comma separated values) This is syntax ID,Last name,first name,theory, 1,Einstein,Albert,"General, Special

More information

Web Applications. Web Services problems solved. Web services problems solved. Web services - definition. W3C web services standard

Web Applications. Web Services problems solved. Web services problems solved. Web services - definition. W3C web services standard Web Applications 31242/32549 Advanced Internet Programming Advanced Java Programming Presentation-oriented: PAGE based App generates Markup pages (HTML, XHTML etc) Human oriented : user interacts with

More information

XML + JSON. Internet Engineering. Spring Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

XML + JSON. Internet Engineering. Spring Bahador Bakhshi CE & IT Department, Amirkabir University of Technology XML + JSON Internet Engineering Spring 2018 Bahador Bakhshi CE & IT Department, Amirkabir University of Technology Questions Q6) How to define the data that is transferred between web server and client?

More information

Using Web Services Chapter 13. Sending Data across the Net. Data on the Web. Python Dictionary. Java HashMap

Using Web Services Chapter 13. Sending Data across the Net. Data on the Web. Python Dictionary. Java HashMap Using Web Services Chapter 13 Unless otherwise noted, the content of this course material is licensed under a Creative Commons Attribution 3.0 License. http://creativecommons.org/licenses/by/3.0/. Copyright

More information

XML Structures. Web Programming. Uta Priss ZELL, Ostfalia University. XML Introduction Syntax: well-formed Semantics: validity Issues

XML Structures. Web Programming. Uta Priss ZELL, Ostfalia University. XML Introduction Syntax: well-formed Semantics: validity Issues XML Structures Web Programming Uta Priss ZELL, Ostfalia University 2013 Web Programming XML1 Slide 1/32 Outline XML Introduction Syntax: well-formed Semantics: validity Issues Web Programming XML1 Slide

More information

MWTM NBAPI WSDL and XSD Definitions

MWTM NBAPI WSDL and XSD Definitions APPENDIXA This appendix describes the WSDL and XSD 1 (XML Schema Definition) definitions for MWTM 6.1.4 Northbound API (NBAPI): InventoryAPI.wsdl, page A-1 EventAPI.wsdl, page A-10 ProvisionAPI.wsdl, page

More information

MWTM 6.1 NBAPI WSDL and XSD Definitions

MWTM 6.1 NBAPI WSDL and XSD Definitions APPENDIXA This appendix describes the WSDL and XSD 1 (XML Schema Definition) definitions for MWTM 6.1 Northbound API (NBAPI): InventoryAPI.wsdl, page A-1 EventAPI.wsdl, page A-5 ProvisionAPI.wsdl, page

More information

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 7 XML Chapter 7 XML 7.1 Introduction extensible Markup Language Developed from SGML A meta-markup language Deficiencies of HTML and SGML Lax syntactical rules Many complex features that are rarely used HTML

More information

QosPolicyHolder:1 Erratum

QosPolicyHolder:1 Erratum Erratum Number: Document and Version: Cross References: Next sequential erratum number Effective Date: July 14, 2006 Document erratum applies to the service document QosPolicyHolder:1 This Erratum has

More information

/// Rapport. / Testdocumentatie nieuwe versie Register producten en dienstverlening (IPDC)

/// Rapport. / Testdocumentatie nieuwe versie Register producten en dienstverlening (IPDC) /// Rapport / Testdocumentatie nieuwe versie Register producten en dienstverlening (IPDC) / Maart 2017 www.vlaanderen.be/informatievlaanderen Informatie Vlaanderen /// Aanpassingen aan de webservices Dit

More information

Chapter 3 Brief Overview of XML

Chapter 3 Brief Overview of XML Slide 3.1 Web Serv vices: Princ ciples & Te echno ology Chapter 3 Brief Overview of XML Mike P. Papazoglou & mikep@uvt.nl Slide 3.2 Topics XML document structure XML schemas reuse Document navigation and

More information

Simple Object Access Protocol. Web Services Description Language

Simple Object Access Protocol. Web Services Description Language Simple Object Access Protocol Web Services Description Language alfady@scs-net.org alnashed@scs-net.org ***"#$%& '() "! ... INTRODUCTION.. SIMPLE OBJECT ACCESS PROTOCOL...Why SOAPSOAP...SOAP Building BlocksSOAP...Syntax

More information

Author: Irena Holubová Lecturer: Martin Svoboda

Author: Irena Holubová Lecturer: Martin Svoboda A7B36XML, AD7B36XML XML Technologies Lecture 5 XML Schema 31. 3. 2017 Author: Irena Holubová Lecturer: Martin Svoboda http://www.ksi.mff.cuni.cz/~svoboda/courses/2016-2-a7b36xml/ Lecture Outline XML schema

More information

Week 2: Lecture Notes. DTDs and XML Schemas

Week 2: Lecture Notes. DTDs and XML Schemas Week 2: Lecture Notes DTDs and XML Schemas In Week 1, we looked at the structure of an XML document and how to write XML. I trust you have all decided on the editor you prefer. If not, I continue to recommend

More information

Document erratum applies to QosDevice:1. List other Erratum s or Documents that this change may apply to or have associated changes with

Document erratum applies to QosDevice:1. List other Erratum s or Documents that this change may apply to or have associated changes with Erratum Number: Document and Version: Cross References: QosDevice:1 Erratum Next sequential erratum number Effective Date: July 14, 2006 Document erratum applies to QosDevice:1 List other Erratum s or

More information

Chapter 11 XML Data Modeling. Recent Development for Data Models 2016 Stefan Deßloch

Chapter 11 XML Data Modeling. Recent Development for Data Models 2016 Stefan Deßloch Chapter 11 XML Data Modeling Recent Development for Data Models 2016 Stefan Deßloch Motivation Traditional data models (e.g., relational data model) primarily support structure data separate DB schema

More information

COMP60411 Semi-structured Data and the Web A bit of XPath, namespaces, and XML schema

COMP60411 Semi-structured Data and the Web A bit of XPath, namespaces, and XML schema COMP60411 Semi-structured Data and the Web A bit of XPath, namespaces, and XML schema week 2 Uli Sattler University of Manchester 1 .plagiarism again... Work through the COMP609PM Plagiarism and Malpractice

More information

XMLSchema2ShEx: Converting XML validation to RDF validation

XMLSchema2ShEx: Converting XML validation to RDF validation Semantic Web 0 (0) 1 1 IOS Press XMLSchema2ShEx: Converting XML validation to RDF validation Herminio Garcia-Gonzalez a, Jose Emilio Labra-Gayo a, a Department of Computer Science, University of Oviedo,

More information

2006 Martin v. Löwis. Data-centric XML. XML Schema (Part 1)

2006 Martin v. Löwis. Data-centric XML. XML Schema (Part 1) Data-centric XML XML Schema (Part 1) Schema and DTD Disadvantages of DTD: separate, non-xml syntax very limited constraints on data types (just ID, IDREF, ) no support for sets (i.e. each element type

More information

XML. Part II DTD (cont.) and XML Schema

XML. Part II DTD (cont.) and XML Schema XML Part II DTD (cont.) and XML Schema Attribute Declarations Declare a list of allowable attributes for each element These lists are called ATTLIST declarations Consists of 3 basic parts The ATTLIST keyword

More information

XML, DTD, and XML Schema. Introduction to Databases CompSci 316 Fall 2014

XML, DTD, and XML Schema. Introduction to Databases CompSci 316 Fall 2014 XML, DTD, and XML Schema Introduction to Databases CompSci 316 Fall 2014 2 Announcements (Tue. Oct. 21) Midterm scores and sample solution posted You may pick up graded exams outside my office Mean: 83.9

More information

[MS-MSL]: Mapping Specification Language File Format. Intellectual Property Rights Notice for Open Specifications Documentation

[MS-MSL]: Mapping Specification Language File Format. Intellectual Property Rights Notice for Open Specifications Documentation [MS-MSL]: Intellectual Property Rights Notice for Open Specifications Documentation Technical Documentation. Microsoft publishes Open Specifications documentation ( this documentation ) for protocols,

More information

XML: extensible Markup Language

XML: extensible Markup Language Datamodels XML: extensible Markup Language Slides are based on slides from Database System Concepts Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use Many examples are from

More information

XML Format Plug-in User s Guide. Version 10g Release 3 (10.3)

XML Format Plug-in User s Guide. Version 10g Release 3 (10.3) XML Format Plug-in User s Guide Version 10g Release 3 (10.3) XML... 4 TERMINOLOGY... 4 CREATING AN XML FORMAT... 5 CREATING AN XML FORMAT BASED ON AN EXISTING XML MESSAGE FORMAT... 5 CREATING AN EMPTY

More information

Transforming XBRL into an OWL Ontology

Transforming XBRL into an OWL Ontology Transforming XBRL into an OWL Ontology Including a comprehensive introduction to XML, XBRL, NTP, Ontologies and OWL Version 1.0 (2007-03-13) Nick Roos 274503 Arjen Vervoort 272407 Maarten Tijhof 275772

More information

Part 2: XML and Data Management Chapter 6: Overview of XML

Part 2: XML and Data Management Chapter 6: Overview of XML Part 2: XML and Data Management Chapter 6: Overview of XML Prof. Dr. Stefan Böttcher 6. Overview of the XML standards: XML, DTD, XML Schema 7. Navigation in XML documents: XML axes, DOM, SAX, XPath, Tree

More information

Cisco Prime Central 1.0 API Guide

Cisco Prime Central 1.0 API Guide Cisco Prime Central 1.0 API Guide Cisco Prime Central API Cisco Prime Central Information Model and API's to support the following features. Managed Elements and Equipment Inventory Object Create, Delete

More information

Using and defining new simple types. Basic structuring of definitions. Copyright , Sosnoski Software Solutions, Inc. All rights reserved.

Using and defining new simple types. Basic structuring of definitions. Copyright , Sosnoski Software Solutions, Inc. All rights reserved. IRIS Web Services Workshop II Session 1 Wednesday AM, September 21 Dennis M. Sosnoski What is XML? Extensible Markup Language XML is metalanguage for markup Enables markup languages for particular domains

More information