 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 20 - Extensible Markup Language (XML) Outline 20.1 Introduction 20.2 Structuring Data 20.3 XML.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 8-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
XML: Extensible Markup Language
 2001 Prentice Hall, Inc. All rights reserved. 1.
4/17/2015Comp Sci 3461 XML_2 Ch. 7. 4/17/2015Comp Sci 3462 XML Vocabularies  MathML  An application to parse, render, and edit MathML: Amaya 
Presentation 6: Introduction to XML and related technologies – for use with SOAP / WSDL = Web services.
1 XML DTD & XML Schema Monica Farrow G30
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
1 Extensible Markup Language: XML HTML: portable, widely supported protocol for describing how to format data XML: portable, widely supported protocol.
XML (Extensible Markup Language)
3 November 2008CIS 340 # 1 Topics To define XML as a technology To place XML in the context of system architectures.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 – Schemas Outline 7.1Introduction 7.2Schemas vs. DTDs 7.3Microsoft XML Schema: Describing Elements.
1 Extensible Markup Language: XML HTML: portable, widely supported protocol for describing how to format data XML: portable, widely supported protocol.
 2002 Prentice Hall, Inc. All rights reserved. ISQA 407 XML/WML Winter 2002 Dr. Sergio Davalos.
 2006 Pearson Education, Inc. All rights reserved Extensible Markup Language (XML)
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic XML.
XML An introduction. xml XML like HTML is created from the Standard Generalized Markup Language, SGML.
1 Extensible Markup Language: XML HTML: widely supported protocol for formatting data XML: widely supported protocol for describing data XML is quickly.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 5 – Creating Markup with XML Outline 5.1Introduction 5.2Introduction to XML Markup 5.3Parsers and.
Presentation 6: Introduction to XML and related technologies.
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
8/6/2015Comp Sci 3461 XML_1 Ch. 7 Fall /6/2015Comp Sci 3462 Bibliography  W3C Recommendations  XML online tutorials.
 2008 Pearson Education, Inc. All rights reserved XML and RSS.
Manohar – Why XML is Required Problem: We want to save the data and retrieve it further or to transfer over the network. This.
 2008 Pearson Education, Inc. All rights reserved XML.
XP New Perspectives on XML Tutorial 3 1 DTD Tutorial – Carey ISBN
Sheet 1XML Technology in E-Commerce 2001Lecture 6 XML Technology in E-Commerce Lecture 6 XPointer, XSLT.
 2001 Deitel & Associates, Inc. All rights reserved. 1 Chapter 27 – XML (Extensible Markup Language) Outline 27.1Introduction 27.2Structuring Data 27.3Document.
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
XML for E-commerce III Helena Ahonen-Myka. In this part... n Transforming XML n Traversing XML n Web publishing frameworks.
XSL XML Stylesheet Langauage. XPath Notation for addressing elements in an XML document /xyz - selects the root element /xyz/abc - selects all elements.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
 2008 Pearson Education, Inc. All rights reserved XML and RSS.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 20 – Extensible Markup Language (XML) Outline 20.1 Introduction 20.2 Structuring Data 20.3 XML.
 2003 Prentice Hall, Inc. All rights reserved. 3 rd Edition Slide 1 Chapter 20 – Extensible Markup Language (XML) Outline 20.1 Introduction 20.2 Structuring.
 2002 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 – Schemas Outline 7.1Introduction 7.2Schemas vs. DTDs 7.3Microsoft XML Schema: Describing Elements.
1 © Netskills Quality Internet Training, University of Newcastle Introducing XML © Netskills, Quality Internet Training University.
Introduction. Document Structure Overview  XML declaration (prolog)  Document type declaration  Root element (namespace)  Document header  Document.
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
 2002 Prentice Hall. All rights reserved. Chapter 17: Enterprise Java Case Study: Architectural Overview Outline 17.1 Introduction 17.2 Deitel Bookstore.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 9: Python XML Processing Xiang Lian The University of Texas – Pan American Edinburg, TX 78539
XP 1 DECLARING A DTD A DTD can be used to: –Ensure all required elements are present in the document –Prevent undefined elements from being used –Enforce.
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.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 34 - Case Study: Active Server Pages and XML Outline 34.1 Introduction 34.2 Setup and Message.
1 Tutorial 13 Validating Documents with DTDs Working with Document Type Definitions.
 2002 Prentice Hall, Inc. All rights reserved. Chapter 6 – Document Type Definition (DTD) Outline 6.1Introduction 6.2Parsers, Well-formed and Valid XML.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
 2001 Prentice Hall, Inc. All rights reserved. Chapter 15 – Case Study: Message Forum with Active Server Pages Outline 15.1Introduction 15.2Setup and.
XML Extensible Markup Language
Web-based Programming Lanjut Pertemuan 9 Matakuliah: M0492 / Web-based Programming Lanjut Tahun: 2007.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 20 – Extensible Markup Language (XML) Outline 20.1 Introduction 20.2 Structuring Data 20.3 XML.
Præsentation 3: Opsummering af Client-Side Teknologier del 2 Internetteknologi 2 (ITNET2)
Introduction to XML This presentation covers introductory features of XML. What XML is and what it is not? What does it do? Put different related technologies.
 2002 Prentice Hall, Inc. All rights reserved. 1 Chapter 12 – XSL: Extensible Stylesheet Language Transformations (XSLT) Outline 12.1Introduction 12.2Setup.
1 Introduction to XHTML: Part 1 Outline Introduction Elements and Attributes Editing XHTML Common Elements W3C XHTML Validation Service Headers Linking.
Sheet 1XML Technology in E-Commerce 2001Lecture 2 XML Technology in E-Commerce Lecture 2 Logical and Physical Structure, Validity, DTD, XML Schema.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
 2008 Pearson Education, Inc. All rights reserved Document Object Model (DOM): Objects and Collections.
Chapter 15: XML TP2543 Web Programming Mohammad Faidzul Nasrudin.
Presentation 6: Introduction to XML and related technologies – for use with SOAP / WSDL = Web services.
CIS 228 The Internet 9/20/11 XHTML 1.0. “Quirks” Mode Today, all browsers support standards Compliant pages are displayed similarly There are multiple.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Extensible Markup Language (XML) Pat Morin COMP 2405.
XML_1 Ch. 7 Fall /6/2017 Comp Sci 346.
Unit 4 Representing Web Data: XML
XML QUESTIONS AND ANSWERS
14 XML and RSS.
Chapter 7 Representing Web Data: XML
Chapter 20 - Extensible Markup Language (XML)
Chapter 20 – Extensible Markup Language (XML)
Presentation transcript:

 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 20 - Extensible Markup Language (XML) Outline 20.1 Introduction 20.2 Structuring Data 20.3 XML Namespaces 20.4 Document Type Definitions (DTDs) and Schemas Document Type Definitions W3C XML Schema Documents 20.5 XML Vocabularies MathML Chemical Markup Language (CML) Other Markup Languages 20.6 Document Object Model (DOM) 20.7 DOM Methods 20.8 Simple API for XML (SAX) 20.9 Extensible Stylesheet Language (XSL) Microsoft BizTalk Simple Object Access Protocol (SOAP) Internet and World Wide Web Resources

 2001 Prentice Hall, Inc. All rights reserved. Outline 2 Article.xml Simple XML 9 10 September 19, Tem 14 Nieto XML is pretty easy Once you have mastered XHTML, XML is easily 20 learned. You must remember that XML is not for 21 displaying information but for managing information Optional XML declaration. Element article is the root element. Elements title, date, author, summary and content are child elements of article.

 2001 Prentice Hall, Inc. All rights reserved Structuring Data Fig. 20.2IE5.5 displaying article.xml.

 2001 Prentice Hall, Inc. All rights reserved. Outline 4 Letter.xml John Doe Main St Anytown 15 Anystate Joe Schmoe 23 Box Any Ave. 25 Othertown 26 Otherstate Element flag is an empty element and does not contain any text. Information for the person writing the letter. Information for the person receiving the letter.

 2001 Prentice Hall, Inc. All rights reserved. Outline 5 Letter.xml Program Output 32 Dear Sir: It is our privilege to inform you about our new 35 database managed with XML. This new system allows 36 you to reduce the load of your inventory list server by 37 having the client machine perform the work of sorting 38 and filtering the data. 39 Sincerely 40 Mr. Doe Body of letter. Author’s signature.

 2001 Prentice Hall, Inc. All rights reserved. Outline 6 Program Output

 2001 Prentice Hall, Inc. All rights reserved. Outline 7 Namespace.xml <text:directory xmlns:text = "urn:deitel:textInfo" 7 xmlns:image = "urn:deitel:imageInfo"> A book list A funny picture Keyword xmlns creates two namespace prefixes, text and image. URIs ensure that a namespace is unique.

 2001 Prentice Hall, Inc. All rights reserved. Outline 8 Defaultnamespace.xml <directory xmlns = "urn:deitel:textInfo" 7 xmlns:image = "urn:deitel:imageInfo"> A book list A funny picture Default namespace. Element file uses the default namespace. Element file uses the namespace prefix image.

 2001 Prentice Hall, Inc. All rights reserved. Outline 9 Letter.dtd <!ELEMENT letter ( contact+, salutation, paragraph+, 5 closing, signature )> 6 7 <!ELEMENT contact ( name, address1, address2, city, state, 8 zip, phone, flag )> The ELEMENT element type declaration defines the rules for element letter. The plus sign ( + ) occurrence indicator specifies that the DTD allows one or more occurrences of an element. The contact element definition specifies that element contact contains child elements name, address1, address2, city, state, zip, phone and flag — in that order. The ATTLIST element type declaration defines an attribute (i.e., type ) for the contact element. Keyword #IMPLIED specifies that if the parser finds a contact element without a type attribute, the parser can choose an arbitrary value for the attribute or ignore the attribute and the document will be valid. Flag #PCDATA specifies that the element can contain parsed character data (i.e., text).

 2001 Prentice Hall, Inc. All rights reserved. Outline 10 Book.xml Program Output XML How to Program C How to Program Java How to Program C++ How to Program Perl How to Program java -classpath.;..\lib\xmlparserv2.jar;..\lib\xschema.jar XSDSetSchema book.xsd book.xml The input file parsed without errors

 2001 Prentice Hall, Inc. All rights reserved. Outline 11 Book.xsd <xsd:schema xmlns:xsd = " 7 xmlns:deitel = " 8 targetNamespace = " <xsd:element name = "book" type = "deitel:BookType" 14 minOccurs = "1" maxOccurs = "unbounded"/> Namespace URI.Namespace prefix. Element element defines an element to be included in the XML document structure. Attributes name and type specify the element ’s name and data type, respectively. Element complexType defines an element type that has a child element named book. Attribute minOccurs specifies that books must contain a minimum of one book element. Attribute maxOccurs, with value unbounded specifies that books may have any number of book child elements.

 2001 Prentice Hall, Inc. All rights reserved. Outline 12 Mathml1.html Program Output 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 3 " Simple MathML Example = Element mrow behaves like parentheses, which allows the document author to group related elements properly.

 2001 Prentice Hall, Inc. All rights reserved. Outline 13 Mathml2.html 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 3 " Algebraic MathML Example &InvisibleTimes; x x x entity reference &InvisibleTimes; to indicate a multiplication operation without a symbolic representation. The msup element represents a superscript.Element mfrac display a fraction.

 2001 Prentice Hall, Inc. All rights reserved. Outline 14 Mathml2.html Program Output 36 =

 2001 Prentice Hall, Inc. All rights reserved. Outline 15 Mathml3.html 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 3 " Calculus MathML Example &Integral; y &InvisibleTimes; 33 The entity &Integral; represents the integral symbol. The msubsup element specifies the superscript and subscript. Element mo marks up the integral operator.Element mn marks up the number (i.e., 0 ) that represents the subscript. Element msqrt represents a square root expression.

 2001 Prentice Hall, Inc. All rights reserved. Outline 16 Mathm13.html Program Output x y δ 46 x Entity δ represents a delta symbol.

 2001 Prentice Hall, Inc. All rights reserved. Outline 17 Ammonia.xml 1 <?jumbo:namespace ns = " 2 prefix = "C" java = "jumbo.cmlxml.*Node" ?> N H H H A processing instruction (PI is application-specific information embedded in an XML document. A value of x2 and type float specifies that the element contains a list of floating-point numbers, each of which indicates the x-coordinate of an atom. A value of y2 specifies that the element contains a list of y- coordinate values. Element bondArray defines the bonds between atoms.

 2001 Prentice Hall, Inc. All rights reserved. Outline 18 Program Output

 2001 Prentice Hall, Inc. All rights reserved DOM Methods

 2001 Prentice Hall, Inc. All rights reserved DOM Methods firstName lastName contents summary author date title article Fig Tree structure for article.xml.

 2001 Prentice Hall, Inc. All rights reserved. Outline 21 DOMExample.html 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 3 " A DOM Example <!-- 17 var xmlDocument = new ActiveXObject( "Microsoft.XMLDOM" ); xmlDocument.load( "article.xml" ); // get the root element 22 var element = xmlDocument.documentElement; document.writeln( 25 " Here is the root node of the document: " + 26 " " + element.nodeName + " " + 27 " The following are its child elements:" + 28 " " ); // traverse all child nodes of root element 31 for ( var i = 0; i < element.childNodes.length; i++ ) { 32 var curNode = element.childNodes.item( i ); 33 Instantiate a Microsoft XML Document Object Model object and assign it to reference xmlDocument. method load loads article.xml (Fig. 20.1) into memory.Property documentElement corresponds to the root element in the document (e.g., article ). Property nodeName corresponds to the name of an element, attribute, etc. Iterates through the root node’s children using property childNodes.Method item to obtain the child node at index i.

 2001 Prentice Hall, Inc. All rights reserved. Outline 22 DOMExample.html 34 // print node name of each child element 35 document.writeln( " " + curNode.nodeName 36 + " " ); 37 } document.writeln( " " ); // get the first child node of root element 42 var currentNode = element.firstChild; document.writeln( " The first child of root node is: " + 45 " " + currentNode.nodeName + " " + 46 " whose next sibling is:" ); // get the next sibling of first child 49 var nextSib = currentNode.nextSibling; document.writeln( " " + nextSib.nodeName + 52 ". Value of " + 53 nextSib.nodeName + " element is: " ); var value = nextSib.firstChild; // print the text value of the sibling 58 document.writeln( " " + value.nodeValue + " " + 59 " Parent node of " + nextSib.nodeName + 60 " is: " + 61 nextSib.parentNode.nodeName + ". " ); 62 --> Retrieve the root node’s first child node (i.e., title ) using property firstChild. Property parentNode returns a node’s parent node.

 2001 Prentice Hall, Inc. All rights reserved. Outline 23 Program Output

 2001 Prentice Hall, Inc. All rights reserved DOM Methods

 2001 Prentice Hall, Inc. All rights reserved DOM Methods

 2001 Prentice Hall, Inc. All rights reserved DOM Methods

 2001 Prentice Hall, Inc. All rights reserved DOM Methods

 2001 Prentice Hall, Inc. All rights reserved. Outline 28 Games.xml Cricket More popular among commonwealth nations Baseball More popular in America Soccer (Football) Most popular sport in the world A processing instruction that references the XSL stylesheet games.xsl. Value type specifies that games.xsl is a text/xsl file.

 2001 Prentice Hall, Inc. All rights reserved. Outline 29 Program Output

 2001 Prentice Hall, Inc. All rights reserved. Outline 30 Elements.xsl <xsl:stylesheet version = "1.0" 8 xmlns:xsl = " <xsl:output method = "html" omit-xml-declaration = "no" 11 doctype-system = 12 " 13 doctype-public = "-//W3C//DTD XHTML 1.0 Strict//EN"/> Sports ID 31 Sport 32 Information The stylesheet start tag—which begins the XSL stylesheet. Element xsl:output writes an XHTML document type declaration to the result tree. The match attribute to select the document root of the source document (i.e., game.xml ).

 2001 Prentice Hall, Inc. All rights reserved. Outline 31 Elements.xsl Element xsl:for-each iterates through the source XML document and search for game elements. Element value-of retrieves attribute id ’s value and place it in a td element in the result tree.

 2001 Prentice Hall, Inc. All rights reserved. Outline 32 Sorting.xml Deitel&apos;s XML Primer Paul 13 Deitel Advanced XML Intermediate XML Parsers and Tools Entities XML Fundamentals 33 Reference to the XSL stylesheet sorting.xsl.

 2001 Prentice Hall, Inc. All rights reserved. Outline 33 Sorting.xml

 2001 Prentice Hall, Inc. All rights reserved. Outline 34 Sorting.xsl <xsl:stylesheet version = "1.0" 7 xmlns:xsl = " 8 9 <xsl:output method = "html" omit-xml-declaration = "no" 10 doctype-system = 11 " 12 doctype-public = "-//W3C//DTD XHTML 1.0 Strict//EN"/> ISBN by, Specify that the msxml processor should apply xsl:template s to the document root’s children. Create the title for the XHTML document.Create a header element that displays the book’s author.

 2001 Prentice Hall, Inc. All rights reserved. Outline 35 Sorting.xsl ( pages ) <xsl:sort select = data-type = "number" 48 order = "ascending"/> Chapter ( pages ) <xsl:sort select = data-type = "text" 62 order = "ascending"/> Appendix Select each element (indicated by an asterisk) that is a child of frontMatter. Call node-set function name to retrieve the current node’s element name (e.g., preface ). Element xsl:sort sorts chapter s by number in ascending order. Attribute select selects the value of attribute number in context node chapter. Attribute data-type specifies a numeric sort and attribute order specifies ascending order.

 2001 Prentice Hall, Inc. All rights reserved. Outline 36 Sorting.xsl ( pages ) Pages: 76 <xsl:variable name = "pagecount" 77 select = Media Type: Use an XSL variable to store the value of the book’s page count and output the page count to the result tree.

 2001 Prentice Hall, Inc. All rights reserved. Outline 37 Program Output

 2001 Prentice Hall, Inc. All rights reserved Microsoft BizTalk

 2001 Prentice Hall, Inc. All rights reserved. Outline 39 BizTalkexample.x ml 1 2 <BizTalk 3 xmlns = "urn:schemas-biztalk-org:BizTalk/biztalk-0.81.xml"> <From locationID = " " locationType = "DUNS" 9 handle = "23" /> <To locationID = " " locationType = "DUNS" 12 handle = "45" /> <Offers xmlns = 17 "x-schema: a-3411d 20 ExComp, Inc. 21 DCS Clothes | Sports wear T13:12: T13:12: Clearance sale 34 This is a clearance sale 35 Free Shipping Defines a default namespace for the BizTalk framework elements. Element Route contains the routing information, which is mandatory for all BizTalk documents. Element To specifies the document’s destination. Element From specifies the document’s source.Element Body contains the actual message, whose schema the businesses define.

 2001 Prentice Hall, Inc. All rights reserved. Outline 40 BizTalkexample.x ml 36 Clothes that you would love to wear