Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 82 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
82
Dung lượng
1,32 MB
Nội dung
Fundamental XML for Developers Dr. Timothy M. Chester Texas A&M University Timothy M. Chester is. . . • Senior IT Manager, Texas A&M University – Application Development, Systems Integration, Developer Tools & Training • Lecturer, Texas A&M College of Business – Courses on Business Programming Fundamentals (VB.NET, C#), XML & Advanced Web Development. • Author – Visual Studio Magazine, Dr. Dobbs Journal, IT Professional • Consultant – President & Principal, eInternet Studios • Contact Information – E-mail: tim-chester@tamu.edu – Web: http://tim-chester.tamu.edu Texas A&M University You Are. . . • Software Developers – New to XML, Object Oriented Development – Require ‘basics’ of XML course • IT Managers – Need familiarity with XML basics and terminology – Interested in how XML can affect both software development and legacy system integration This session . . . • Assumes you know nothing about XML or XML based technologies • Provides a basic introduction to XML based technologies • Demonstrates some of the basics of working with the DOM, XSLT, Schema, WSDL, and SOAP. Agenda XML • Document Object Model (DOM) • XPATH • XSLT • Schema • WSDL • SOAP • Questions Underlying Technologies XML Is the Glue Program the Web X M L Browse the Web H T M L T C P / I P Connect the Web T e c h n o l o g y I n n o v a t i o n Connectivity Presentation Connecting Applications F T P , E - m a i l , G o p h e r W e b P a g e s W e b S e r v i c e s Evolution of Web Generation 1 Static HTML HTML Generation 2 Web Applications HTML HTML, XML HTML, XML Generation 3 Web Services Other Web Services Partner Web Service Partner Web Service Data Access and Storage Tier Application Business Logic Tier YourCompany.com Internet + XML Web Services Overview Application Model Other Applications End Users Introducing XML • XML stands for Extensible Markup Language. A markup language specifies the structure and content of a document. • Because it is extensible, XML can be used to create a wide variety of document types. [...]... hello – Must be well-formed XML Parsers • An XML processor (also called XML parser) evaluates the document to make sure it conforms to all XML specifications for structure and syntax • XML parsers are strict It is this rigidity built into XML that ensures XML code accepted by the parser will work the same everywhere XML Parsers • Microsoft’s parser is called MSXML and is built directly in... Well-formed XML Documents (cont.) • XML parsers support – Document Object Model (DOM) • Builds tree structure containing document data in memory – Simple API for XML (SAX) • Generates events when tags, comments, etc are encountered – (Events are notifications to the application) Parsing an XML Document with MSXML • XML document – Contains data – Does not contain formatting information – Load XML document... DOM Components • Manipulate XML document Agenda XML Document Object Model (DOM) XPATH • XSLT • Schema • WSDL • SOAP • Questions Introduction • XML Path Language (XPath) – Syntax for locating information in XML document • e.g., attribute values – String-based language of expressions • Not structural language like XML – Used by other XML technologies • XSLT Nodes • XML document – Tree structure... Introducing XML • HTML cannot be applied consistently Different browsers require different standards making the final document appear differently on one browser compared with another Introduction to XML Markup • XML document (intro .xml) – Marks up message as XML – Commonly stored in text files • Extension xml 1 2 3 4 5 6 7 8 < ?xml version = "1.0"?> Document begins with declaration that specifies XML version... Node created for element message – Element message has child node for body element – Element body has child node for text "Hi, Tim!" – Attributes from and to also have nodes in tree DOM Implementations • DOM-based parsers – Microsoft’s msxml – Microsoft.NET System .Xml Namspace – Sun Microsystem’s JAXP Creating Nodes • Create XML document at run time Traversing the DOM • Use DOM to traverse XML document... declaration that specifies XML version 1.0 .xml > XML markup > Welcome to XML! Line numbers are not part of XML document We include them for clarity Element message is child element of root element myMessage Introduction to XML Markup (cont.) • XML documents – Must contain exactly one root element • Attempting... <>& Agenda XML Document Object Model (DOM) • XPATH • XSLT • Schema • WSDL • SOAP • Questions Introduction • XML Document Object Model (DOM) – Build tree structure in memory for XML documents – DOM-based parsers parse these structures • Exist in several languages (Java, C, C++, Python, Perl, C#, VB.NET, VB, etc) Introduction • DOM tree – Each node represents an element, attribute, etc < ?xml version... document shown in IE6 Character Set • XML documents may contain – Carriage returns – Line feeds – Unicode characters • Enables computers to process characters for several languages Characters vs Markup • XML must differentiate between – Markup text • Enclosed in angle brackets (< and >) – e.g, Child elements – Character data • Text between start tag and end tag – Welcome to XML! – Elements versus Attributes... XML • XML is a subset of a the Standard Generalized Markup Language (SGML) which was introduced in the 1980s SGML is very complex and can be costly • These reasons led to the creation of Hypertext Markup Language (HTML), a more easily used markup language XML can be seen as sitting between SGML and HTML – easier to learn than SGML, but more robust than HTML The Limits of HTML • HTML was designed for. .. HTML The Limits of HTML • HTML was designed for formatting text on a Web page It was not designed for dealing with the content of a Web page Additional features have been added to HTML, but they do not solve data description or cataloging issues in an HTML document • Because HTML is not extensible, it cannot be modified to meet specific needs Browser developers have added features making HTML more . be well-formed Introduction to XML Markup (cont.) XML Parsers • An XML processor (also called XML parser) evaluates the document to make sure it conforms to all XML specifications for structure. to XML Markup • XML document (intro .xml) – Marks up message as XML – Commonly stored in text files • Extension .xml 1 < ?xml version = "1.0"?> 2 3 <! Fig. 5.1 : intro .xml. Parsing an XML Document with MSXML • XML document – Contains data – Does not contain formatting information – Load XML document into Internet Explorer 5.0 • Document is parsed by msxml. • Places