Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Fundementals XML vs.. HTML XML vs.. HTML XML Document (elements vs. attributes) XML Document (elements vs. attributes) XML and RDBMS XML and RDBMS.

Similar presentations


Presentation on theme: "XML Fundementals XML vs.. HTML XML vs.. HTML XML Document (elements vs. attributes) XML Document (elements vs. attributes) XML and RDBMS XML and RDBMS."— Presentation transcript:

1 XML Fundementals XML vs.. HTML XML vs.. HTML XML Document (elements vs. attributes) XML Document (elements vs. attributes) XML and RDBMS XML and RDBMS XML Schema (DTD; XSD) XML Schema (DTD; XSD) XPATH XPATH XSLT (XSL; XSLT) XSLT (XSL; XSLT) SYSTEM.XML SYSTEM.XML XSD Classes and Types XSD Classes and Types Serialization Process Serialization Process

2 Any need for re-query or sorting of existing data required a new round-trip to the server. HTML

3 HTML and XML are both “firewall friendly” XML separate data from presentation XML is not a markup language XML defines the data content and structure HTML vs. XML

4 Anatomy of XML Document Op-Centre Steve Pieczenik 25.99 Design Patterns Erich Gamma Richard Helm Ralph Johnson 34.00 Prolog Root Element NamespaceElementAttribute DATA / PCDATA

5 Creating XML Documents Messages Relational databases Server Pages Legacy systems Other XML documents XML document XML document

6 Op-Centre Steve Pieczenik 25.99 Design Patterns Erich Gamma 59.00 Design Patterns Ralph Johnson 59.00 Design Patterns Ralph Johnson 59.00 The hierarchical nature of XML Op-Centre Steve Pieczenik 25.99 Design Patterns Erich Gamma Richard Helm Ralph Johnson 59.00

7 How would you? 1.Add new Author that has no book’s isbn yet. 2.Remove the ‘ 0-00-649845-0 ’ row but keep the author ‘ Steve Pieczenik ’. 3.Change the title ‘ Design Patterns ’ without having to do it in many places. SELECT Books.isbn, Books.title, Authors.name as 'author', Books.price FROM Books, BooksAuthors, Authors WHERE Books.isbn = BooksAuthors.isbn and BooksAuthors.AuthorID = Authors.AuthorID Hierarchical support in relational databases 1/2 ‘BooksAuthors’ table ‘Authors’ table ‘Books’ table

8 Hierarchical support in relational databases 2/2 Select Books.*, Authors.name as Authors from Books, BooksAuthors, Authors where Books.isbn = BooksAuthors.isbn and BooksAuthors.AuthorID = Authors.AuthorID order by Books.isbn for xml auto

9 XML Schema DTD (Old W3C standard, supported by all …) DTD (Old W3C standard, supported by all …) XDR (Microsoft only) XDR (Microsoft only) XSD (W3C standard as of May 2001) XSD (W3C standard as of May 2001) ELEMENTS DTD XDR / XSD Min Occurs Max Occurs ?01 11 *0* +1*

10 Bookstore DTD - Sample DEMO – Validating XML with DTD

11 Bookstore XSD - Sample Open Sample Open Sample Open Sample Open Sample

12 Using XSLT Capabilities An XSLT style sheet can perform a wide range of transformations An XSLT style sheet can perform a wide range of transformations Examples: Examples: Map one XML grammar to another Map one XML grammar to another Filter unwanted data Filter unwanted data Sort XML data Sort XML data Restructure an XML document Restructure an XML document Perform computations Perform computations

13 Transforming XML into a Different XML Grammar XML document XSLT style sheet + XSLT processor Different XML grammar Reid 91000 … Reid 91000 … <staff-member name="Reid" pay="91000"/> … <staff-member name="Reid" pay="91000"/> …

14 Transforming XML into HTML XML document XSLT style sheet + XSLT processor XHTML document (XML compliant) Reid 91000 … Reid 91000 … Reid 91000 … Reid 91000 …

15 What Is XPath? XPath maps an XML document to a tree of nodes XPath maps an XML document to a tree of nodes Use XPath expressions to identify, select, and manipulate nodes in an XML hierarchy Use XPath expressions to identify, select, and manipulate nodes in an XML hierarchy Use location paths to select nodes Use location paths to select nodes XPath operators and functions XPath operators and functions

16 Why Use XPath? In XSLT style sheets, for pattern matching In SQL Server 2000, to address result-set nodes In XPointer, to link documents together System.xml to select nodes programmatically XML XPath

17 Using XSLT on the Server Apply a stylesheet to a document on the server Apply a stylesheet to a document on the server Transform between different schemas Transform between different schemas Merge data sources Merge data sources Conversion based on business processes and requirements Conversion based on business processes and requirements Convert XML into well-formed HTML Convert XML into well-formed HTML XSLT Different XML grammar XML Another server IE5 client Other browser HTML XML

18 SYSTEM.XML Hello System.Xml Hello System.Xml Quick overview - libraries tools and goals. Quick overview - libraries tools and goals. Integrating XML into your applications. Integrating XML into your applications. XML & Performance = streaming-based model XML & Performance = streaming-based model XML Transformation with performance in mind. XML Transformation with performance in mind. Demo Demo Optional: Accessing Raw SOAP Messages in ASP.NET Web Services Optional: Accessing Raw SOAP Messages in ASP.NET Web Services Hierarchical vs. Relational representation of data. Hierarchical vs. Relational representation of data. Why do we need them both. Why do we need them both. XML Integration with Relational Data. XML Integration with Relational Data. Demo Demo

19 Hello System.Xml System.Xml System.Xml System.Xml.Schema System.Xml.Schema System.Xml.Serialization System.Xml.Serialization System.Xml.XPath System.Xml.XPath System.Xml.Xsl System.Xml.Xsl Design Goals Compliance with the W3C standards Extensibility Pluggable architecture Performance Tight integration with ADO.NET Toolsxsd.exe Xml schema designer Data Adapter Wizard External tools

20 XML & Performance = streaming-based model XmlReader XmlReader Minimal caching for forward-only pull model parsing. Minimal caching for forward-only pull model parsing. XmlValidatingReader XmlValidatingReader Forward-only validation. Forward-only validation. XPathNavigator XPathNavigator cursor style navigation cursor style navigation minimizes node creation to a single virtual node minimizes node creation to a single virtual node yet provides random access to the document. yet provides random access to the document. does not require a complete node tree to be built in memory (DOM) does not require a complete node tree to be built in memory (DOM) XslTransform XslTransform Incremental streaming output. Incremental streaming output.

21 XML Transformation with performance in mind

22

23 Hierarchical vs. Relational representation of data

24

25 Discussion: Why do we need them both? Discussion: Why do we need them both?

26 XML Integration with Relational Data and ADO.NET

27 When to synchronize an XmlDataDocument with a DataSet When to load XML directly into a DataSet XPath queries are needed over data in the DataSet. Queries of data in the DataSet are easier using SQL than XPath Preservation of element ordering in the source XML is critical. Preservation of element ordering in the source XML is not critical. White space and formatting preservation in the source XML is critical. White space between elements and formatting does not need to be preserved in the source XML.

28 Synchronizing a DataSet with an XmlDataDocument Sample Code …

29 Serialization Process Classes used by the default Serialization Process Classes used by the default Serialization Process Classes used with Serialized Streams, File Stream, Memory Stream, Net Stream Classes used with Serialized Streams, File Stream, Memory Stream, Net Stream Binary Formatter Binary Formatter SOAP Formatter SOAP Formatter De-serialization De-serialization

30 XSD Classes and Types Using xsd.exe to generate schema from classes Using xsd.exe to generate schema from classes Using xsd.exe to generate classes from schema Using xsd.exe to generate classes from schema XSD Types XSD Types Demo Demo

31 Review XML vs.. HTML XML vs.. HTML XML Document (elements vs. attributes) XML Document (elements vs. attributes) XML and RDBMS XML and RDBMS XML Schema (DTD; XSD) XML Schema (DTD; XSD) XPATH XPATH XSLT (XSL; XSLT) XSLT (XSL; XSLT) SYSTEM.XML SYSTEM.XML XSD Classes and Types XSD Classes and Types Serialization Process Serialization Process


Download ppt "XML Fundementals XML vs.. HTML XML vs.. HTML XML Document (elements vs. attributes) XML Document (elements vs. attributes) XML and RDBMS XML and RDBMS."

Similar presentations


Ads by Google