1 / 13

XML

XML. eXtensible Markup Language w3c standard Why? Store and transport data Easy data exchange Create more languages WSDL (Web Service Description Language) RDF (Resource Description Framework) RSS (Really Simple Syndication) Self-describing data Easy to learn Must learn.

Télécharger la présentation

XML

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 • eXtensible Markup Language • w3c standard • Why? • Store and transport data • Easy data exchange • Create more languages • WSDL (Web Service Description Language) • RDF (Resource Description Framework) • RSS (Really Simple Syndication) • Self-describing data • Easy to learn • Must learn

  2. 3 Major Components • XML • XSL (eXtensible Stylesheet Language) • Style sheet language for XML documents • XSD (XML Schema Definition) • Describes the structure of an XML document

  3. XML Document <?xml version="1.0"?> <!-- this is a sample --> <note> <to>Tove</to> <from source=”contacts”>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> Processing Instruction Comment Element Attribute

  4. XML Documents • Well formed and Valid • Well formed • Should only contain one root element • All tags should have corresponding end tag • Tags never overlap(<author><name> … </author></name>) • Attributes must be quoted • Valid • Must be well formed and conforms to the schema

  5. XML Documents • Has tree structure • Tags are case sensitive • <name> is different from <Name> • Comments <!-- this is a comment -->

  6. XML Elements • Can contain • Other elements • Text • Attributes • Valid names • <name>, <first_name>, <first2names> • Invalid names • <2nd_name>, <$amount>, <firstname>

  7. XML elements and Attributes • Data goes as elements • <person><name>john</name></person> • Meta data goes as attributes • <image type='gif'><name>graph.gif</name></image>

  8. 1.0 vs 1.1 • 1.0 – everything not permitted is forbidden • 1.1 – everything not forbidden is permitted • 1.0 is compatible with 1.1, not vise-versa • Forward compatible • Does not affects to English documents

  9. XML Namespaces • There can be common elements in multiple domains • File in hardware and office <file> <length>18</length> <price>3.69</price> <file> <file> <content>Employee data</content> <numberOfPages>25</numberOfPages> </file>

  10. XML Namespaces • How to distinguish? • Solution : namespaces <h:file xmlns:h="http://www.hardware.com/"> <h:length>18</h:length> <h:price>3.69</h:price> <h:file> <o:file xmlns:o="http://www.office.com/people"> <o:content>Employee data</o:content> <o:numberOfPages>25</o:numberOfPages> </o:file>

  11. XML Parsers • A piece of software which reads the content from the XML documents and present it to the application • Implementing xml parser • Java way • SAX (Simple API for XML) • DOM (Document Object Model) • StAX (Streaming API for XML)

  12. XML Parsers • XML Parser Demos

  13. XML Parsers

More Related