xml

17
XML BIS4430 – unit 10

Upload: buckminster-dixon

Post on 01-Jan-2016

27 views

Category:

Documents


1 download

DESCRIPTION

XML. BIS4430 – unit 10. XML Origins. Extensible Markup Language (XML) 1998 Inspired by Standard Generalized Markup Language (SGML) and HTML. SGML defines how any given markup language can be formally specified HTML combines markup from several categories: Text Structuring Tags , - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: XML

XML

BIS4430 – unit 10

Page 2: XML

XML Origins• Extensible Markup Language (XML) 1998

• Inspired by Standard Generalized Markup Language (SGML) and HTML.

• SGML defines how any given markup language can be formally specified

• HTML combines markup from several categories: Text Structuring Tags <H1>,

• Formatting Tags <B>, Linking <A>, <IMG>, and Data Input Tags <FORM>,<INPUT>

Page 3: XML

The key benefits of XML are:

· Readable by both humans and computers

· Facilitates the optimal structuring of data

· Free and/or inexpensive

· Widely available

· Easy to learn

· Supported by all major software vendors

Page 4: XML

XML vs HTML

<book><title>XML by Example</title><author>Sean McGrath</author><publisher>Prentice Hall, Inc.</publisher><publish_date>1999</publish_date><description>Building E-commerce Applications with XML</description></book>

<P>Book</P><P>Title: XML by Example</P><P>Author: Sean McGrath</P><P>Publisher: Prentice Hall, Inc.</P><P>Date Published: 1999</P><P>Description: Building E-commerce Applications </P>

Page 5: XML

Namespaces

• Namespaces resolve ambiguous element tag names, in order to associate correct elements in an XML document.

Page 6: XML

Namespaces

OrderInfo.xml

<Order_Info>

<Name>John Dow</Name>

<Address>19 Footlong Court</Address>

<City>Tallwood</City>

<Order>Cigars</Order>

<Date>31-12-02</Date>

</Order_Info>

BillingInfo.xml

<Billing_Info>

<Name>Angela Dow</Name>

<Payment>Visa</Payment>

<Number>12344</Number>

</Billing_Info>

Page 7: XML

Namespaces: Explicit<order: Order_Info xmlns:order =”http://www.mdx.ac.uk/~ariel/order”

xmlns:bill=“http://www.mdx.ac.uk/~ariel/bill” >

<order:Name >John Dow</order:Name>

< order:Address>19 Footlong Court</ order:Address>

< order:City>Tallwood</ order:City>

< order:Order>Cigars</ order:Order>

< order:Date>31-12-02</ order:Date>

<bill:Billing_Info >

< bill:Name >Angela Dow</bill:Name>

< bill:Payment>Visa</ bill:Payment>

< bill:Number>12344</ bill:Number>

</ bill:Billing_Info>

</ order:Order_Info>

Page 8: XML

XML Parsers

• XML processor is used to read XML documents and provide access to their content and structure

• It is assumed that an XML processor is doing its work on behalf of another module, called the application

Page 9: XML

XML Processing

Page 10: XML

Parsers• Nonvalidating – they simply verify if the

document adheres to rules of the XML syntax i.e. whether the XML document is well formed

• Validating – these parsers read in XML documents, check if they are well formed and verify their compliance with a specified XML schema or other validation set, i.e. they verify if the XML document is valid.

Page 11: XML

Content Access

Page 12: XML

Converting XML with XSLT

• XSL technologies allow to transform XML documents into various formats, such as PDF( Adobe Acrobat Reader), WML for wireless devices, and into HTML.

Page 13: XML

Retrieve the element content

• <xsl:value-of select="element name goes here"/>

• <xsl:if test= "boolean-expression-goes here">....</xsl:if>

<xsl:for-each select="element name goes here">

<!--processing instructions go here-->

</xsl:for-each>

Page 14: XML

Example

xsl:for-each select="student_list/student">

<b>Name: </b><xsl:value-of select="name"/><p/><b>ID: </b><xsl:value-of select="student_ID"/><p/><b>Studying : </b><xsl:value-of select="major"/>

</xsl:for-each>

Page 15: XML

Database Integration

• XML Database Mapping– More description on next slide

• Using Native XML Databases– Store XML data in XML document– Data is serialised

Page 16: XML

XML Database Mapping

• Associate elements in an XML document with the relational database fields.

• Query the database with SQL

• Convert results into an XML document

• Popular solution: Java & JDBC

Page 17: XML

XML Web Services

• Advantages of Web Services– Component independence

– Component based

– XML based interfaces