1 / 46

XML = W3C

XML = W3C. http://www.w3.org/Consortium/Offices/Presentations/. XML Roadmap.

bairn
Download Presentation

XML = W3C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML = W3C http://www.w3.org/Consortium/Offices/Presentations/

  2. XML Roadmap In addition to core technology standards, developed by the W3C, XML has served as the basis for a host of standards that provide for a more specific application or business function. Typically, application standards are developed by industry groups that have a common business interest. Among these XML-based standards we find ICE, SVG, MathML, OFX, XTM, and ebXML. Each of these standards relies upon XML and often other core standards. ICE is a specialized transaction protocol for automating the distribution of content among business partners. PICS provides a mechanism whereby independent groups can develop metadata vocabularies without naming conflict. A P3P policy enables web sites to express their privacy practices in a standard format that can be read automatically by software such as IE6 and Netscape 7

  3. HTML 5 Working Draft • New and changed elements and attributes The idea of these new types is that the user agent can provide the user interface, such as a calendar date picker or integration with the user's address book and submit a defined format to the server. It gives the user a better experience as his input is checked before sending it to the server meaning there is less time to wait for feedback. • New APIs • 2D drawing API which can be used with the new canvas element. • API for playing of video and audio which can be used with the new video and audio elements. • Persistent storage. Both key / value and a SQL database are supported. • An API that enables offline Web applications. • An API that allows a Web application to register itself for certain protocols or MIME types. • Editing API in combination with a new global contenteditable attribute. • Drag & drop API in combination with a draggable attribute. • Network API. • API that exposes the history and allows pages to add to it to prevent breaking the back button. (This API has the necessary security restrictions in place.) • Cross-document messaging. • Server-sent events in combination with the new event-source element. • Notification API to alert the user to new information, such as new e-mail messages in an e-mail application. HTML5 draft http://www.w3.org/html/wg/html5/ HTML 4 and 5 differencies http://www.w3.org/TR/html5-diff/

  4. Amaya Amaya is a Web editor, i.e. a tool used to create and update documents directly on the Web. Browsing features are seamlessly integrated with the editing and remote access features in a uniform environment. This follows the original vision of the Web as a space for collaboration and not just a one-way publishing medium. Work on Amaya started at W3C in 1996 to showcase Web technologies in a fully-featured Web client. The main motivation for developing Amaya was to provide a framework that can integrate as many W3C technologies as possible. It is used to demonstrate these technologies in action while taking advantage of their combination in a single, consistent environment. Amaya started as an HTML + CSS style sheets editor. Since that time it was extended to support XML and an increasing number of XML applications such as the XHTML family, MathML, and SVG. It allows all those vocabularies to be edited simultaneously in compound documents. http://www.w3.org/Amaya/

  5. XML makes Data more Useful to more users. Since XML is independent of hardware, software and application, you can make your data available to others Other clients and applications can access your XML files as data sources, like they are accessing databases. Your data can be made available to all kinds of "reading machines" (agents), and it is easier to make your data available.

  6. XML can be used to .. • With XML, plain text files can be used to store data. • XML can also be used to store data in files or in databases. Applications can be written to store and retrieve information from the store. • Generic applications can be used to display the data.

  7. Well-formed Documents Data objects that conform to the XML syntax specification are well formed XML documents.Such documents can be used without DTD or schema and are known also as standalone XML documents. Data objects are well-formed XML documents if: • Starts with a xml declaration is NOT compulsory • Syntax conforms to the XML specification, start and end tags are nested propely • Elements form a hierarchical tree, with a single root node • There are no reference to external entities, unless DTD is provided • If dtd or XSL is provided, then standalone =”no” • First line is NOT a comment line if xml declaration is used • XML parser that encounters a construct with xml data that is not well-formed must report this erros as a ”fatal error”. • Warnings, which generally don't need further action • Errors, which are actual problems • Fatal errors (such as a document that is not well-formed), that prevents processing to continue

  8. Valid Documents A well-formed document conforms to the rules of XML. A validating parser is expected to retrieve the DTD and ensure the well-formed document conforms to the grammar the DTD describes. A valid document must meet constraints specified by the DTD. Furthermore, its root element must be the one specified in the DTD/Schema. Validity check is only as good as the DTD. You need to know how to write effective DTDs / Schemas.

  9. Validating Process A parser must interpret any XML document before an application can use it, typically to create either a DOM document or a SAX stream. In either case, the parser looks at each character of the document and decides whether it is an element, attribute, string of data, and so on. Validation occurs when the parser also checks the structure of the document against the DTD or schema if it has been configured to do so. DOM parser is one which makes the entire XML passed as a tree structure and will have it in memory. Any modification can be done to the XML. The problem: The XML documents you have to parse are getting too large to load the entire document tree into memory; performance is suffering. SAX parser is one which triggers predefined events when the parser encounters the tags in XML. Event-driven parser. Entire XML will not be stored in memory. Bit faster than DOM. NO modifications can be done to the XML.

  10. DTD Example of Validation note_dtd_error.xml note_dtd_parsing.htm

  11. What is XHTML? • EXtensible HyperText Markup Language • XHTML is almost identical to HTML 4.01 • XHTML is a stricter and cleaner version of HTML • XHTML is HTML defined as an XML application • XHTML 1.0 became an official W3C Recommendation January 26, 2000. HTML 4.01 Reference XHTML 1.0 References

  12. XHTML document types • XHTML 1.0 Strict <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Use this when you want really clean markup, free of presentational clutter. Use this together with Cascading Style Sheets. • XHTML 1.0 Transitional <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Use this when you need to take advantage of HTML's presentational features and when you want to support browsers that don't understand Cascading Style Sheets. • XHTML 1.0 Frameset <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> Use this when you want to use HTML Frames to partition the browser window into two or more frames.

  13. XHTML 1.0 Differencies to HTML 4.01 • Main differencies html 4.0 vs. xhtml 1.0 • XHTML elements must be properly nested • XHTML documents must be well-formed • Tag names must be in lowercase • All XHTML elements must be closed • Attribute values must be quoted Mandatory elements: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN“ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>title here</title> </head> <body> </body> </html> Attribute minimization is forbidden: <input disabled> ► <input disabled=”disabled” /> <option selected> ► <option selected=”selected” /> The id attribute replaces the name attribute <img src=“s.gif" name=“s" /> ► <img src=“s.gif" id=“s" />

  14. XHTML 1.1 Hybrid Markup <?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>XHTML as the host language</title> </head> <body> ... XHTML content ... <math xmlns="http://www.w3.org/1998/Math/MathML"> ... MathML content ... </math> ... XHTML content ... <svg:svg version="1.1" xmlns:svg=http://www.w3.org/2000/svg xmlns:xlink="http://www.w3.org/1999/xlink"> ... SVG content ... <svg:switch> <svg:foreignObject ...> <p> ... XHTML content ... <math xmlns="http://www.w3.org/1998/Math/MathML"> ... MathML content ... </math> ... XHTML content ... </p> </svg:foreignObject> </svg:switch> </svg:svg> </body> </html>

  15. XHTML 1.1 Hybrid Markup: MathML <math xmlns="&mathml;"> <!--group any number of sub-expressions horizontally--> <mrow> <!-- subscribt, needs two identifiers--> <msub> <!--*** 1. identifier is base--> <mi>&delta;</mi> <!--*** 2. identifier is subscipt--> <mi>&alpha;</mi> </msub> <msup> <mi>F</mi> <!--*** identifier list separated by semicolon --> <mi>&alpha;&beta;</mi> </msup> <!--*** space (no identifier) --> <mi></mi> <!--*** operator = --> <mo>=</mo> <mi></mi> <!--*** form a fraction from two sub-expressions --> <mfrac> <mrow> <!--**** number --> <mn>4</mn> <!--**** asymbolic constant --> <mi>&pi;</mi> </mrow> <mi>c</mi> </mfrac> <mi></mi> …

  16. XHTML 1.1 Hybrid Markup: SVG <html> <head><title>SVG Task 1</title></head> <body> <p style="text-align:center"> <a href="javascript:self.close()">Close window</a> </p> <h2>Animated elements with motion path</h2> <object type="image/svg+xml" data="SVGTask1B.svg" width="500" height="500"> </object> </body> </html>

  17. CSS - The Style Sheet of HTML • Because HTML uses predefined tags, the meanings of these tags are well understood: The <p> element defines a paragraph and the <h1> element defines a heading; and the browser knows how to display them. • Adding styles to HTML elements with CSS is simple. Telling a browser to display each element in a special font or color, is easy to do and easy for a browser to understand.  CSS2 Reference

  18. XSL XSL consists of three parts: • XSLT (a language for transforming XML documents) • XPath (a language for defining parts of an XML document) • XSL Formatting Objects (a vocabulary for formatting XML documents) Think of XSL as a language that can transform XML e.g. into XHTML, a language that can filter and sort XML data, a language that can define parts of an XML document, a language that can format XML data based on the data value, like displaying negative numbers in red, and a language that can output XML data to different devices, like screen, paper or voice = multi-channelling. XSL Reference (W3C)

  19. XSLT - XSL Transformations • XSLT is the most important part of the XSL Standard. It is the part of XSL that is used to transform an XML document into another XML document, or another type of document that is recognized by a browser. One such format is XHTML. XSLT does this by transforming each XML element into an XHTML element. • XSLT can also add new elements into the output file, or remove elements. It can rearrange and sort elements, and test and make decisions about which elements to display, and a lot more. • A common way to describe the transformation process is to say that XSL uses XSLT to transform an XML source tree into an XML result tree.

  20. XSLT - How does it work? Transformation processor, XSLT uses XPath to define parts of the source document that match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document.

  21. Processing XML documents In order to process an XML document using XSL, you will need an XML parser with an XSL Engine (XMLTransformer). E.g. Internet Explorer 6 supports the official W3C XSL Recommendation. The MSXML Parser - shipped with Internet Explorer 6.0 and Windows XP - is based on both the W3C XSLT 1.0 and the W3C XPath 1.0 Recommendations. Remark: Usually the document is parsed on server side and not in browser. Use the browser’s parser to study the procedure used.

  22. MSXML Parser Microsoft XML Core Services 6.0 (earlier version called XML Parser 4.0 or 3.0) • Wiki http://en.wikipedia.org/wiki/MSXML • MSDN Downloads MSXML 6.0 http://www.microsoft.com/downloads/details.aspx?FamilyID=993C0BCF-3BCF-4009-BE21-27E85E1857B1&displaylang=en

  23. <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0” xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Title</th> <th align="left">Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/> </td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> ref: cdcatalog.xsl XSLT XSL - Transformation • Link the XSL Style Sheet to the XML Document <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> … </catalog>ref: cdcatalog_with_xsl.xml

  24. XSLT Example on Server The source code needed to transform the XML file to XHTML on the server (cdcatalog.asp): <% 'Load XML set xml = Server.CreateObject("Microsoft.XMLDOM") xml.async = false xml.load(Server.MapPath("cdcatalog.xml")) 'Load XSL set xsl = Server.CreateObject("Microsoft.XMLDOM") xsl.async = false xsl.load(Server.MapPath("cdcatalog.xsl")) 'Transform file Response. Write(xml.transformNode(xsl)) %> The first block of code creates an instance of the Microsoft XML parser (XMLDOM), and loads the XML file into memory. The second block of code creates another instance of the parser and loads the XSL document into memory. The last line of code transforms the XML document using the XSL document, and returns the result to the browser.

  25. XSL-FO

  26. XML DOM Reference The XML Document Object Model (DOM) is a programming interface for XML documents. It defines the way an XML document can be accessed and manipulated .NET, Java, C++, Scripts … • XML DOM - Node object.htm

  27. XML Schema XML Schema is an XML based alternative to DTD XML Schema defines the legal building blocks of an XML document, just like a DTD. An XML Schema: • 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 phonebook.xsd

  28. XML Schemas Benefits With the support for data types: • It is easier to describe permissible 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

  29. Schema is more describing <?xml version="1.0" encoding="ISO-8859-1" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name=”person" > <xs:complexType> <xs:sequence> <xs:element name=”firstname" type="xs:string"/> <xs:element name=”surname" type="xs:string" minOccurs="0"/> <xs:element name=”age" type="xs:positiveInteger"/> <xs:element name=”weight" type="xs:decimal"/> </xs:sequence> </xs:complexType> </xs:element> <xs:attribute name=”nationality" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:schema> <?xml version="1.0" encoding="ISO-8859-1"?> <person nationality=”finnish" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=”person.xsd"> <firstname> Kake</firstname> <surname> Aaltonen</surname> <age > 102</age> <weight>99.5</weight> </person>

  30. The phonebook element is said to be of a complex type because it contains other elements. The other elements (firstname, surname) are said to be simple types because they do not contain other elements. The <schema> element is the root element of every XML Schema XSD Example phonebook.xsd with namespace <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://users.evtek.fi" xmlns="http://users.evtek.fi" elementFormDefault="qualified"> <xs:element name=”phonebook"> <xs:complexType> <xs:sequence> <xs:element name=”firstname" type="xs:string"/> <xs:element name=”surname" type="xs:string"/> <xs:element name=”address”> <xs:complexType> ……… </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

  31. XML Namespace • Namespaces are the solution to the problems of ambiguity and name collisions. • DTD/XSD can be a namespace or an uri its self • xmlns:kake=http://users.evtek.fi/~karita/xml • http://users.evtek.fi/~karita/xml/phonebook.xsd • <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> Namespace Namespace abc.dtd <…name> xyz.dtd <…phone> xmlns:a=”abc.dtd” xmlns:b=”xyz.dtd” <a:name> Kalle … <b:phone> 040 …. Document

  32. XPath • XPath is a syntax for defining parts of an XML document • XPath uses paths to define XML elements • XPath is a major element in XSLT • XPath is not written in XML • XPath is a W3C Standard • Xpointer for addressing individual parts of document <xsl:value-of select="count(/phonebook/person)"/> / Parent – child relationship // Selects nodes in the document from the current node that matches the selection no matter where they are @ Selects attributes

  33. XPath Terminology <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> </bookstore> Nodes In XPath, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment, and document (root) nodes. XML documents are treated as trees of nodes. The root of the tree is called the document node (or root node). Atomic values Atomic values are nodes with no children or parent. Items Items are atomic values or nodes. Ancestors A node's parent, parent's parent, etc. Parent Each element and attribute has one parent. Children Element nodes may have zero, one or more children. Descendants A node's children, children's children, etc Siblings Nodes that have the same parent.

  34. XForms • XForms Separate Data from Presentation • XForms use XML to define forms • XForms use XML to transport data • XForms are device independent Separating data from presentation also makes XForms device independent, because the data model can be used for all devices. Because the data model is not tied to its presentation, the presentation can be customized for different user interfaces, like mobile phones, handheld devices, and Braille readers… Since XForms are device independent and based on XML, it is also possible to add other XML applications like VoiceML (speaking web data), WML (Wireless Markup Language) to XForms. • http://www.w3.org/MarkUp/Forms/ • http://www.w3.org/TR/xforms/

  35. SOAP SOAP = XML + HTTP = minimal set to access • SOAP stands for Simple Object Access Protocol • SOAP is a communication protocol • SOAP is for communication between applications • SOAP is a format for sending messages • SOAP is designed to communicate via Internet • SOAP is platform independent • SOAP is language independent • SOAP is based on XML • SOAP is simple and extensible • SOAP allows you to get around firewalls

  36. Strength of SOAP It is important for application development to allow Internet communication between programs. Today's applications communicate using Remote Procedure Calls (RPC) between objects like DCOM and CORBA, but HTTP was not designed for this. RPC represents a compatibility and security problem; firewalls and proxy servers will normally block this kind of traffic. A better way to communicate between applications is over HTTP, because HTTP is supported by all Internet browsers and servers. SOAP was created to accomplish this. SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.

  37. POST /InStock HTTP/1.1 Request Host: www.stock.org Content-Type: application/soap; charset=utf-8 <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.stock.org/stock" />    <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope> SOAP Example HTTP/1.1 200 OK Response Connection: close Content-Type: application/soap; charset=utf-8 Date: Sat, 12 May 2002 08:09:04 GMT <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:Body xmlns:m="http://www.stock.org/stock" /> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body> </soap:Envelope>

  38. WSDL WSDL stands for Web Services Description Language. WSDL is a document written in XML. The document describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes

  39. WSDL and UDDI • Platform-independent framework for describing services, discovering businesses, and integrating business services by using the Internet. • UDDI stands for Universal Description, Discovery and Integration • UDDI is a directory for storing information about web services • UDDI is a directory of web service interfaces described by WDSL • UDDI communicates via SOAP • UDDI is built into the Microsoft .NET platform

  40. How can UDDI be Used? If the industry published an UDDI standard for flight rate checking and reservation, airlines could register their services into an UDDI directory. Travel agencies could then search the UDDI directory to find the airline's reservation interface. When the interface is found, the travel agency can communicate with the service immediately because it uses a well-defined reservation interface.

  41. Web Services Example Consumer Directory UDDI Find service (WSDL) Send order Confirm order; Delivery Service for checking address info E-shop requesting checking services Service for checking credit info Electronic commerce

  42. .NET Microsoft.NET • .NET is a new Internet and Web based infrastructure • .NET delivers software as Web Services • .NET is a framework for universal services • .NET is a server centric computing model • .NET will run in any browser on any platform • .NET is based on the newest Web standards .NET Internet Standards • HTTP, the communication protocol between Internet Applications • XML, the format for exchanging data between Internet Applications • SOAP, the standard format for requesting Web Services • UDDI, the standard to search and discover Web Services

  43. FOR $p IN document("bib.xml")//publisher LET $b := document("bib.xml)//book[publisher = $p] WHERE count($b) > 100 RETURN $p DBase Query Lanquage: XQuery • The main engine of XQuery is the FLWR expression: • FOR-LET-WHERE-RETURN • pronounced "flower" • generalizes SELECT-FROM-HAVING-WHERE from SQL • FOR generates an ordered list of bindings of publisher names LET associates to each binding a further binding of the list of book elements with that publisher • at this stage, we have an ordered list of tuples of bindings: ($p,$b) • WHERE filters that list to retain only the desired tuples • RETURN constructs for each tuple a resulting value • The combined result is in this case and ordered list of publishers that publish more than 100 books.

  44. Kari Aaltonen Java import org.apache.xerces.parsers.DOMParser; import java.io.File; import org.w3c.dom.Document; public class SchemaTest { public static void main (String args[]) { File docFile = new File(”evtek.xml"); try { DOMParser parser = new DOMParser(); parser.setFeature("http://xml.org/sax/features/validation", true); parser.setProperty(http://…. noNamespaceSchemaLocation", ”evtek.xsd"); ErrorChecker errors = new ErrorChecker(); parser.setErrorHandler(errors); parser.parse(”evtek.xml"); } catch (Exception e) { System.out.print("Problem parsing the file."); }}} • Create the parser • Turn on validation. • Set the error handler. • Parse the document. • ErrorChecker reports any errors e.g. improperly nested element or improperly added attribute. • In this way, all documents are checked against a DTD/ schema (internal or external) or Well-Formed only.

  45. Internet Distributed Services Applications are a Set of Services • Applications are broken down into a number of smaller individual services. Services are not the same as executables, or components, or DLL's. Services should be answers to submitted requests. Services should be returned as data. • Develop services as a number of server-side HTML or XML pages. Services are not Purpose Built • Applications manage new changes in the requirements. Future changes should easily hook into our application.  • Create flexible standard services that are used to serve a lot of different requests. Services are easy to Create and Edit • If a service has to be coded, use scripts. Services are never be compiled into executables that makes services too hard to access and to edit. Any pre-compiled component used in an application will threaten the possibility of creating an application that can move, scale and gracefully support future extensions or changes. Services are created and modified by editing their properties and methods only.

  46. Self Describing Applications Services and data must be Self Describing • Application clients are able to query a server for a service and to ask for the current server functions. Clients and servers are also able to exchange data in a way so that both understand each element in the data. • Use an XML based information vocabulary with a DTD (Document Type Definition) to exchange server functions, and to use XML to exchange data.

More Related