1 / 27

Comp2513 XML – eXtensible Markup Language

Comp2513 XML – eXtensible Markup Language. Daniel L. Silver, Ph.D. Objectives. To discuss problems with the HTML based web and introduce XML (and related methods) as the next generation markup language References: DDEA Ch. 8, Sharma Ch.7 and External Web Links. Outline.

Download Presentation

Comp2513 XML – eXtensible Markup Language

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. Comp2513XML – eXtensible Markup Language Daniel L. Silver, Ph.D.

  2. Objectives • To discuss problems with the HTML based web and introduce XML (and related methods) as the next generation markup language • References: DDEA Ch. 8, Sharma Ch.7 and External Web Links Daniel L. Silver

  3. Outline • Problems with the HTML based Web • The XML idea • XML fundamentals • XML use Daniel L. Silver

  4. Problems with the HTML based Web • HTML documents focus on display and not structure and meaning of data - an information maze devoid of meaning • Inefficient use of tags (every instance of data must be tagged) • Fixed number of tags - can not be extended (not extensible) • HTML search is based on keywords without context • Client-server applications cannot easily exchange data using HTML Daniel L. Silver

  5. HTML focuses on display syntax • HTML tags such as <B>Simpson<\B> tell how to display the word “Simpson” • Focus is on presentation (format, syntax) • But its does not define what “Simpson” means • A persons name? A city? A company? • Or its structural relationship to other data • Full name? Last name? First name? Daniel L. Silver

  6. The XML idea • eXtensible Markup Language • XML defines meaning (semantics): <lname>Simpson<\lname> • In terms of structural relationships … • Independent of presentation <mail_adrs> <fname>Homer<\fname> <lname>Simpson<\lname> <strnum>1234<\strnum> <str>Hickup Lane<\str> <\mail_adrs> Daniel L. Silver

  7. What is XML? • 1996 - A simplified form of SGML for the web (Standardized General Markup Language) • Both machine and human readable • Separates content, structure and presentation • Extensible (users can define structure and meaning) • Supports information reuse and processing autonomy (application decides how to use/present) SGML XML HTML Daniel L. Silver

  8. The W3C’s Basic Requirements for XML • XML shall be straightforwardly usable over the Internet. • XML shall support a wide variety of applications. • XML shall be compatible with SGML. • It shall be easy to write programs which process XML documents. • The number of optional features in XML is to be kept to the absolute minimum, ideally zero. • XML documents should be human-legible and reasonably clear. • XML documents should be easy to prepare. • The design of XML shall be formal and concise. • Terseness in XML markup is of minimal importance. Daniel L. Silver

  9. XML Fundamentals <?xml version = "1.0"?> … <contacts> <contact> <LastName>Black</LastName> <FirstName>John</FirstName> </contact> … </contacts> <!ELEMENT contacts (contact)* > <!ELEMENT contact (LastName, FirstName) > <!ELEMENT LastName (#PCDATA) > <!ELEMENT FirstName (#PCDATA) > DTD Structure Presentation in Context XML Content XSL Presentation <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl = "http://www.w3.org/TR/WD-xsl"> … Daniel L. Silver

  10. XML’s Intended Use • Standard format for exchanging data • Promote cross-platform and cross-application schema – independent of data content, use and presentation • Oriented toward giving meaning to data, and does not emphasize display issues • Client – describes valid data for display • Server – describes valid data for exchange Daniel L. Silver

  11. XMLs Intended Use • Allows organizations to maintain proprietary databases while at the same time communicate information with one another • Schemas for specific domains have been created: • Music • Chemical symbols • Mathematical formulas • Common industry models (EDI for B2B) • Web resource descriptions (directories, addresses) Daniel L. Silver

  12. XML versus HTML • XML is not a replacement for HTML • XML and HTML were designed with different goals: • HTML was designed to display data and to focus on how data looks • XML was designed to describe data and to focus on what data means • They complement each other Daniel L. Silver

  13. XML eXtensibility • XML allows you to create your own definitions of data and there relationship to other pieces of data • Thus the name eXtensible • ** Note that XML is case sensitive ** <?xml version="1.0"?> <People> <Person> <Name> <First>Patrick</First> <Last>Joe</Last> </Name> </Person> </People> Daniel L. Silver

  14. Using IE to Explore XML • You can use Internet Explorer to view an XML document directly • A plus (+) or minus sign (-) to the left of the XML elements can be clicked to expand or collapse the element structure • Or view the raw XML source using "View Source" from the browser menu • Example: cd_catalog.xml Daniel L. Silver

  15. Defining XML Structure • DTD – Document Type Definition defines the fields in an XML document and their relation to one another (schema) • Meta-data : data about data • Can be included in .xml file or referenced as a .dtd file • Used by applications to validate XML data <!ELMENT People (Person)* > <!ELMENT Person (Name) > <!ELMENT Name (First, Last) > <!ELMENT First (#PCDATA) > <!ELMENT Last (#PCDATA) > Daniel L. Silver

  16. Processing an XML Document <?xml version="1.0"?> <People> <Person> <Name> <First>Patrick</First> <Last>Joe</Last> </Name> </Person> </People> <!ELMENT People (Person)* > <!ELMENT Person (Name) > <!ELMENT Name (First, Last) > <!ELMENT First (#PCDATA) > <!ELMENT Last (#PCDATA) > DTD Structure XML Content • An application that wishes to use XML • data should parse the data using a DTD. • There are two approaches: • DOM – read the entire document using the • DTD and build a tree of elements • SAX – parse on demand (interactively) • as each new element is encountered DOM = Document Object Model SAX = Simple API for XML Daniel L. Silver

  17. Processing an XML Document • Internet Explorer 5.0 (+) has a built in DOM-based XML parser, msxml • DTD can be embedded in XML or referenced • Examples: • simple_example.xml with DTD embedded • letter.xml and letter.dtd Daniel L. Silver

  18. Displaying XML Documents • Can be accomplished in various ways, any program that can parse the XML can display the information • Here is a simple HTML solution … • simple_contact.html - XML is embedded, DTD is not required • Javascript could be used instead • article.xml and DOMexample.html • note.xml and note.html Daniel L. Silver

  19. Displaying XML Documents • An XSL – eXtensible Stylesheet Layout can be used • Examples: Basic - contact3.xml using contact_list3.xsl Full function – contact.xml using contact_list.xsl Handheld – contact2.xml using contact_list2.xsl <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl = "http://www.w3.org/TR/WD-xsl"> … Daniel L. Silver

  20. Transferring Data with XML • It is possible to use XML as a method of transferring meaningful data between applications even when application databases do not match • Adherence to XML DTD is the key ODBC JDBC XML DB2 App A App B Oracle Common DTD Daniel L. Silver

  21. Smart Searches on the Internet • With XML and DTDs, keyword searches on the Internet can now be aimed at the appropriate systems, databases, pages • A syntactic search using IE: “cook New York kitchen restaurant” … would become … • A semantic search: <occupation>cook</occupation> <city>New York</city> Daniel L. Silver

  22. VXML • Voice XML • Sound embedded as content and processed as per style sheet • Other media types will be used as well Daniel L. Silver

  23. eadmin and XML • Eadmin • load.jsp?id=91 • servlet/LoadStore • StoreLoader(store,xmlfile) store.xml store.dtd Daniel L. Silver

  24. References • http://www.w3.org/XML/ • http://www.xmlfiles.com/xml/ Daniel L. Silver

  25. THE ENDdanny.silver@acadiau.ca

  26. XML • eXtensible Markup Language • HTML tags such as <B>Silver<\B> tell how to display the word “Silver” • But its does not define what it means • XML defines meaning: <last_name>Silver<\last_name> • And to create structure … Daniel L. Silver

  27. Major Architectural Components of the Web Bank Server Client 1 Dedicated Browser HTTP TCP/IP Server A HTTP Server App. Server Database Server Internet Client 2 Browser prog.cgi URL index.html Server B Bank Server Daniel L. Silver

More Related