Download presentation
Presentation is loading. Please wait.
1
XML e X tensible M arkup L anguage http://www.w3schools.com/xml http://www.cafeconleche.org 1/23
2
What is XML ● stands for eXtensible Markup Language ● a markup language much like HTML ● designed to describe data ● tags not predefined ● you must describe your own tags ● uses a Document Type Definition (DTD) or an XML Schema to describe data 2/23
3
XML and HTML ● different goals ● HTML designed to display data ● how data looks ● about displaying information ● XML designed to describe data ● what data is ● about describing information ● structuring, storing & sending information 3/23
4
what does XML do? ● XML can be used to exchange data ● many different applications ● over the internet ● XML can be used to create new languages ● WAP (Wireless Application Protocol) ● WML (Wireless Markup Language) XML doesn’t do anything 4/23
5
XML a cross-platform, software & hardware independent tool for transmitting information 5/23
6
XML example Vti 1.3 litres 81kW @ 6000 rpm 42 litres 6/23 9
7
XML syntax ● XML declaration ● root element ● XML elements 7/23
8
XML elements ● everything from (including) start tag to (including) end tag ● tags are case sensitive ● != ● can have sub elements … 8/23
9
XML attributes ● XML elements can have attributes in the start tag ● ● additional information about elements ● not part of data ● elements or attributes? 9/23 7
10
elements or attributes ● example 1 – date attribute ….. ● example 2 - date element 1/9/05 ….. ● example 3 – expanded date element 1 9 05 ….. 10/23
11
avoid attributes ● cannot contain multiple values ● not easily expandable – future ● cannot describe structures ● more difficult to read 11/23
12
rule of thumb metadata should be stored as attributes the data should be stored as elements 12/23
13
XML validation ● XML with correct syntax is Well Formed ● a DTD (Document Type Definition) defines the legal contents of an XML document ● an XML schema is an alternative to a DTD 13/23
14
XML schemas ● ability to specify data types for content and attribute values ● ability to validate complex structures ● namespace awareness 14/23
15
why not DTDs ● no data typing ability ● e.g. can’t say element must be an integer 1-12 ● non-XML syntax ● cannot be parsed by same parser ● difficult to modularize and combine ● cannot enforce order or number of child elements 15/23
16
what is a schema ● hypothetical outline - pattern ● document that describes permissible content of a database ● many schema languages for XML ● W3C XML Schema Language ● by convention – in.xsd extension 16/23
17
schema example Hello XML! How are you? <GREETING xsi:noNamespaceSchemaLocation=“Greeting.xsd” xmlns:xsi=“http://www.w3.org/2001/XML Schema - instance”> Hello XML! 17/23
18
schema structure ● root element - schema ● usually namespace bound to prefix xsd or xs ● elements declared using xsd:element ● name attribute specifies which element declared ● type attribute declares data type ● attach schema to XML document by adding xsi:noNamespaceSchemaLocation attribute to the document’s root element 18/23
19
XML example Vti 1.3 litres 81kW @ 6000 rpm 42 litres 19/23 20
20
schema example 20/23 19
21
XML example house 3 180 storey1 </component storey2 storey3 21/23 22
22
schema example <xsd:element name=“no.of storeys” type=“xsd:positiveInteger” maxInclusive=“4”/> <xsd:element name=“component” type=“xsd:string maxOccurs=“unbounded”/> 22/23 21
23
aecXML ● working group – 1999 ● for exchange of AEC specific information ● http://xml.coverpages.org/aecXML.html ● XML schemas for communication ● designing, specifying, estimating, sourcing, installing & maintaining products & materials over the Internet ● AISC steel information in XML ● Bentley -2001 ● aecXML & IFC ● http://www.cadinfo.net/editorial/aecxml.htm 23/23
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.