Title: XML Extensible Markup Language
1XMLExtensible Markup Language
- Kaj A. Jørgensen
- Aalborg University, Department of Production
2Extensible Markup Language (XML)
- XML looks like HTML but is more than HTML
- XML will not replace HTML XML will complement
HTML - XML is extensible users can define custom tags
- Data can be formatted for displaying with HTML
- With XML, the meaning of data can be represented
- XML is a metalanguage
- a language for making new markup languages
- XML is a simplification of Standard Generalized
Markup Language (SGML) - Public software available for XML processing,
e.g. i Java
3XML Schema Definition and Style Definition
- XML Schema and Document Type Definition (DTD)
- Separate files defining the structure of XML
documents - Well-formed XML documents folows the rules of XML
- Valid XML documents are well-formed and conforms
with a schema file or DTD file - Extensible Style Language (XSL)
- Style sheets can be written in XSL
- With XSL, XML documents can be formatted, e.g. in
HTML - Different XSL style sheets can format XML
documents differently
4HTML Example lt!-- The original html recipe
--gt ltHTMLgt ltHEADgtltTITLEgtLime Jello Marshmallow
Cottage Cheese Surpriselt/TITLEgtlt/HEADgt ltBODYgt ltH3gt
Lime Jello Marshmallow Cottage Cheese
Surpriselt/H3gt ltPgtMy grandma's favorite (may she
rest in peace).lt/Pgt ltH4gtIngredientslt/H4gt ltTABLE
BORDER"1"gt ltTR BGCOLOR"308030"gt ltTHgtQtylt/THgtltTH
gtUnitslt/THgtltTHgtItemlt/THgtlt/TRgt ltTRgtltTDgt1lt/TDgtltTDgtbo
xlt/TDgtltTDgtlime gelatinlt/TDgtlt/TRgt ltTRgtltTDgt500lt/TDgtlt
TDgtglt/TDgtltTDgtmulticolored tiny marshmallowslt/TDgtlt/
TRgt ltTRgtltTDgt500lt/TDgtltTDgtmllt/TDgtltTDgtcottage
cheeselt/TDgtlt/TRgt ltTRgtltTDgtlt/TDgtltTDgtdashlt/TDgtltTDgtTab
asco sauce (optional)lt/TDgtlt/TRgt lt/TABLEgt ltH4gtInstr
uctionslt/H4gt ltOLgt ltLIgtPrepare lime gelatin
according to package instructions...lt/LIgt lt!--
and so on --gt lt/BODYgt lt/HTMLgt
5Hypertext Markup Language (HTML)
- Characteristics of HTML
- isn't extensible
- is very display-centric
- isn't directly reusable
- only provides one 'view' of data
- has little or no semantic structure
- HTML documents are presented with a browser
- View the HTML document with the IE
browserexample Recipe.html
6XML tags User Definable
End tag
Empty tag
7lt?xml version"1.0"?gtltRecipegt   ltNamegtLime
Jello Marshmallow Cottage Cheese
Surpriselt/Namegt   ltDescriptiongt My grandma's
favorite (may she rest in peace).lt/Descriptiongt Â
 ltIngredientsgt      ltIngredientgt         ltQty
unit"box"gt1lt/Qtygt         ltItemgtlime
gelatinlt/Itemgt      lt/Ingredientgt      ltIngredie
ntgt         ltQty unit"g"gt500lt/Qtygt         ltIte
mgtmulticolored tiny marshmallowslt/Itemgt      lt/In
gredientgt      ltIngredientgt         ltQty
unit"ml"gt500lt/Qtygt         ltItemgtCottage
cheeselt/Itemgt      lt/Ingredientgt      ltIngredien
tgt         ltQty unit"dash"/gt         ltItem
optional"1"gtTabasco saucelt/Itemgt      lt/Ingredie
ntgt   lt/Ingredientsgt   ltInstructionsgt      ltSte
pgtPrepare lime gelatin according to package
instructionslt/Stepgt      lt!-- And so on...
--gt   lt/Instructionsgtlt/Recipegt
8Characteristics of XML
- Simple rules
- No unclosed tags
- No overlapping tags exampleltTomatogtLet's call
ltPotatogtthe whole thing offlt/Tomatogtlt/Potatogt - Attribute values must be enclosed in quotes
- The text characters (lt), (gt), and (") must be
represented by 'character entities' (lt),
(gt), and (quot) - The tag names define the meaning of data
- Data meaning information
- The hierarchy of tags define the information
structure - The tags don't define how the document is
displayed - Browsers can display XML documentes example
Recipe.xml
9Document Type Definition (DTD)
- DTD example
- lt!ELEMENT Recipe (Name, Description?,
Ingredients?, Instructions?)gt - lt!ELEMENT Name (PCDATA)gt
- lt!ELEMENT Description (PCDATA)gt
- lt!ELEMENT Ingredients (Ingredient)gt
- lt!ELEMENT Ingredient (Qty, Item)gt
- lt!ELEMENT Qty (PCDATA)gt
- lt!ATTLIST Qty unit CDATA REQUIREDgt
- lt!ELEMENT Item (PCDATA)gt
- lt!ATTLIST Item optional CDATA "0"Â isVegetarian
CDATA "true"gt - lt!ELEMENT Instructions (Step)gt
10XML Schema example ltxsdschema
xmlnsxsd"http//www.w3.org/1999/XMLSchema"gt ltxsd
element name"shipOrder" type"order"/gt ltxsd
complexType name"order"gt ltxsdelement
name"shipTo" type"shipAddress"/gt
ltxsdelement name"items"
type"cdItems"/gt lt/xsdcomplexTypegt ltxsdcomplexTy
pe name"shipAddress"gt ltxsdelement
name"name" type"xsdstring"/gt
ltxsdelement name"street"
type"xsdstring"/gt ltxsdelement
name"address" type"xsdstring"/gt
ltxsdelement name"country"
type"xsdstring"/gt lt/xsdcomplexTypegt ltxsdcomple
xType name"cdItems"gt ltxsdelement
name"item" type"cdItem"/gt lt/xsdcomplexType
gt ltxsdcomplexType name"cdItem"gt ltxsdelement
name"title" type"xsdstring"/gt
ltxsdelement name"quantity"
type"xsdpositiveInteger"/gt ltxsdelement
name"price" type"xsddecimal"/gt lt/xsdcomple
xTypegt lt/xsdschemagt
11XML document conforming to the XML Schema lt?xml
version"1.0"?gt ltshipOrdergt ltshipTogt
ltnamegtTove Svendsonlt/namegt ltstreetgtRagnhildvei
2lt/streetgt ltaddressgt4000 Stavangerlt/addressgt
ltcountrygtNorwaylt/countrygt lt/shipTogt
ltitemsgt ltitemgt lttitlegtEmpire
Burlesquelt/titlegt ltquantitygt1lt/quantitygt
ltpricegt10.90lt/pricegt lt/itemgt ltitemgt
lttitlegtHide your heartlt/titlegt
ltquantitygt1lt/quantitygt ltpricegt9.90lt/pricegt
lt/itemgt lt/itemsgt lt/shipOrdergt
12Exchanging XML Documents
13Exchanging XML Documents, cont.
14Application Integration
15New Internet Technologies and Standards
- An Internet service
- expose and describe itself to other applications
- can be located by other applications via
directories - can be invoked by using standard protocols
- XML based standards are currently available
- Simple Object Access Protocol (SOAP)
- Web Services Desription Language (WSDL)
- Universal Desription, Discovery, and Integrat.
(UDDI)a standard for new ways of publishing
services - conform to the basic request and response
functionality - supported by the World Wide Web Consortium (W3C)
16Simple Object Access Protocol (SOAP)
- Lightweight protocol for exchange of information
- The protocol is XML based, simple and extensible
- The SOAP standard consists of three parts
- the SOAP envelope, what message and who should
handle it - the SOAP encoding rules, serialisation mechanisms
- the SOAP remote procedure call representation
- SOAP envelope is an XML document with
- SOAP header, optional
- SOAP body, the message body, a set of body entries
17Conclusion
- XML Extensible Markup Language
- Meta language users kan define specific
languages, custom tags - The tag names define the meaning of data
- XML Schema definition of the structure of XML
documents - Extensible Style Language (XSL) document
formatting - Style sheets are XML documents written in XSL
- Product data models can be formulated in XML
- Data exchange can be based on XML and XML Schema
- International solutions E-business XML, WEB
services