Presentation is loading. Please wait.

Presentation is loading. Please wait.

Martin Kruliš 14. 1. 2016 by Martin Kruliš (v1.1)1.

Similar presentations


Presentation on theme: "Martin Kruliš 14. 1. 2016 by Martin Kruliš (v1.1)1."— Presentation transcript:

1 Martin Kruliš 14. 1. 2016 by Martin Kruliš (v1.1)1

2  eXtensible Markup Language ◦ Universal format for semistructured data  Plain text interleaved with XML markup  Designed for structural (tree-like) data ◦ The structure of a document can be specified  By a grammar (schema) designed by the author of the application ◦ Tools and libraries for XML processing  Parsing and construction (SAX, DOM)  Searching (XPath, XQuery)  Transformations 14. 1. 2016 by Martin Kruliš (v1.1)2

3 Karel Novák karel.novak@centrum.cz Jane Doe jane.doe@coldmail.com 14. 1. 2016 by Martin Kruliš (v1.1)3

4  Document Structure ◦ XML document is well formed if it conforms to XML specification (tag syntax) ◦ Well formed documents can be parsed correctly  Document Semantics ◦ XML document is valid (with respect to given schema) if its structure can be derived from the grammar specified in the schema ◦ Validation can be performed by existing tools, which are also integrated in parsers 14. 1. 2016 by Martin Kruliš (v1.1)4

5  Document Schema ◦ DTD  Simple schema syntax embedded in XML specification  Defines only the document (elements) structure  No constraints for textual data  Could be included in XML document ◦ XML Schema  More robust language, more features  Schema definition is also a XML document  Supported by most parsers 14. 1. 2016 by Martin Kruliš (v1.1)5

6  Simple API for XML (SAX) ◦ Processes document sequentially ◦ Reports important events in sequential processing  Opening and closing tags, found attributes, text, … ◦ For one-way or streaming processing  Document Object Model (DOM) ◦ Similar API to HTML DOM ◦ Entire object is loaded in a object tree structure ◦ For modifications, transformations, … 14. 1. 2016 by Martin Kruliš (v1.1)6

7  XPath ◦ Query language for XML documents ◦ Reflects the tree-based structure of the data and operates on sets of nodes ◦ Each query is a sequence of steps, each step takes set of nodes and produces another set ◦ Also contains filtering predicates and basic set of functions (arithmetics, logical and string fncs, …) /descendant::foo[attribute::id]/child::bar 14. 1. 2016 by Martin Kruliš (v1.1)7 Selects elements bar, which are direct children of those elements foo, which have attribute id

8 14. 1. 2016 by Martin Kruliš (v1.1)8 self attributechild parent namespace ancestor descendant descendant-or-self following-sibling preceding-sibling preceding following

9  Extensible Stylesheet Language (XSL) ◦ XSL = XSLT + XSL-FO (+ XPath)  XSLT – transformation language  XSL-FO – set of formatted objects 14. 1. 2016 by Martin Kruliš (v1.1)9 XSLT XML document XSLT processor The result (XML, HTML, or plain text)

10 14. 1. 2016 by Martin Kruliš (v1.1)10 plain text XML document XSLT processor XSLT šablona XSLT template XSL-FO document PDF TeX source code Browser TeXXSL formatter JSON data HTML document …

11  XSL Transformations ◦ Language that specifies transformation templates  The template is also an XML ◦ The templates…  Use XPath to select parts of the transformed XML document  Each part is then transformed using given rules ◦ The result of an XML transformation is either XML document, HTML document, or plain text ◦ The language is Turing complete 14. 1. 2016 by Martin Kruliš (v1.1)11 Example 1

12  Asynchronous Javascript and XML ◦ XML is used as universal format for transferring data (usually from server to client)  Can be parsed using DOM API in Javascript  Has been replaced by JSON in most cases ◦ XML advantages over JSON  Document validation  XPath searching  XSLT transformations 14. 1. 2016 by Martin Kruliš (v1.1)12

13  Web Services ◦ Set of standards for remote method invocation ◦ Simple Object Access Protocol (SOAP)  XML based protocol for data marshaling  SOAP messages are transferred via HTTP ◦ Web Service Description Language (WSDL)  Interface definition language that specifies the details of a web service (operations, message format, …) ◦ Universal Description, Discovery & Integration (UDDI)  Registry for web services  Operates also as a web service 14. 1. 2016 by Martin Kruliš (v1.1)13 Example

14  XML Applications on the Web ◦ Data exchange and application integration  Universal nature of the XML makes it perfect candidate for situations, when separate subjects need to exchange data or integrate functionality ◦ Simple storage for tree-shaped data  If a relational database does not fit your problem  XML data can be easily visualized by XSLT ◦ Special cases  Application configuration  … 14. 1. 2016 by Martin Kruliš (v1.1)14

15 14. 1. 2016 by Martin Kruliš (v1.1)15


Download ppt "Martin Kruliš 14. 1. 2016 by Martin Kruliš (v1.1)1."

Similar presentations


Ads by Google