Presentation is loading. Please wait.

Presentation is loading. Please wait.

SAP Web AS – Basics of XML and XSLT Sam Tingleff Technology Product Management, SAP Labs.

Similar presentations


Presentation on theme: "SAP Web AS – Basics of XML and XSLT Sam Tingleff Technology Product Management, SAP Labs."— Presentation transcript:

1 SAP Web AS – Basics of XML and XSLT Sam Tingleff Technology Product Management, SAP Labs

2  2002 SAP Labs, LLC, Sam Tingleff 2 Agenda What is XML? SAX & DOM XSL Transformation Basics Summary

3  2002 SAP Labs, LLC, Sam Tingleff 3 What is XML? Character data and markup XML is made up of characters, some form character data, other form markup Markup represents the document's storage layout and logical structure XML keeps markup logically separated from data but physically associated with it The XML specification (http://www.w3.org/xml)http://www.w3.org/xml describes a class of data objects called XML documents partially describes the behavior of computer programs, which process them

4  2002 SAP Labs, LLC, Sam Tingleff 4 What does XML look like? This is XML And this is XML Hitchhiker’s guide to the Galaxy 42 Introduction to Java programming Rules for XML data to be well-formed: No overlapping tags like  Closing tag for each tag Only one root element XML is case sensitive XML preserves spaces This is not XML

5  2002 SAP Labs, LLC, Sam Tingleff 5 XML in brief Comments Prolog Empty elements instead of Processing instructions Attributes John Smith Entities and CData & = ‘&’, <= ‘ ’, &apos; = ‘, " = “

6  2002 SAP Labs, LLC, Sam Tingleff 6 Sample XML Document   action  com.sapmarkets.wef.controller.TxActionServlet  debug 2  …

7  2002 SAP Labs, LLC, Sam Tingleff 7 Agenda What is XML SAX & DOM XSL Transformation Basics Summary

8  2002 SAP Labs, LLC, Sam Tingleff 8 XML/XSL Processors and JAXP Client JAXP API XML Processor (Vendor A) XML Processor (Vendor B) JAXP - Java API for XML Parsing Standard API implemented by different XML Processor vendors Not connected to a concrete implementation Standardized by Sun‘s Java Community Process

9  2002 SAP Labs, LLC, Sam Tingleff 9 Components of JAXP JAXP 1.1 SAX parser (SAX 2) DOM parser (DOM level 2) Transformation API for XML (XSLT 1.0) JAXP 1.2 JAXP 1.1 + XML Schema support Standardized by Sun‘s Java Community Process Part of J2SE 1.4 (Java 2 Platform Standard Edition) Part of J2EE 1.3 (Java 2 Platform Enterprise Edition)

10  2002 SAP Labs, LLC, Sam Tingleff 10 SAX Parsing Simple API for XML (parsing) Event based collection of interfaces Useful with large documents … Some Info Here … Some Info Here … startDocument() startElement(“name”, …) characters(“Some …”) endElement(“name”) endDocument() startDocument() startElement(“name”, …) characters(“Some …”) endElement(“name”) endDocument() event

11  2002 SAP Labs, LLC, Sam Tingleff 11 … Smith John … Smith John … parse DOM parsing Tree (Object) based model Easy to use and manipulate Entire document held in memory

12  2002 SAP Labs, LLC, Sam Tingleff 12 Agenda What is XML SAX & DOM XSL Transformation Basics Summary

13  2002 SAP Labs, LLC, Sam Tingleff 13 Overview of XSLT XSLT processor Transformation of the XML data according to a given stylesheet XML FileXSL File Output : XML Output : HTMLOutput : Text

14  2002 SAP Labs, LLC, Sam Tingleff 14 XSLT simple example … XSL John Smith … XSL John Smith … … XSL John Smith … … XSL John Smith … transformer XSL John Smith XML file HTML output XSL fileBrowser output

15  2002 SAP Labs, LLC, Sam Tingleff 15 XSL namespace <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.1'> This is an XSL stylesheet. An XSL stylesheet is an XML file whose root element is a stylesheet. All elements that refer to the XSL transformation must be of the XSLT namespace: "http://www.w3.org/1999/XSL/Transform" We usually map the xsl: prefix to that URI by convention An must have a version attribute. If its value is not '1.0' or '1.1', the XSLT processor will know that it might not recognize all XSLT instructions and will enable the so-called "forwards-compatible processing".

16  2002 SAP Labs, LLC, Sam Tingleff 16 Example (1) The stylesheet is going to perform simple re-formatting of the source XML: Convert all s to s with the same contents Convert all elements to "[link to X]", where X is the href attribute of Add the comment to the beginning.

17  2002 SAP Labs, LLC, Sam Tingleff 17 Example (2) Transformed! [Link to ' ']

18  2002 SAP Labs, LLC, Sam Tingleff 18 Example (3) Source Document This is a nice example. The site of W3C is This is a nice example. The site of W3C is [Link to 'www.w3.org'] Result Document

19  2002 SAP Labs, LLC, Sam Tingleff 19 Final Exam When would you use the DOM API? SAX? Which is used to create a new XML document? Give an example usage of XSLT.

20  2002 SAP Labs, LLC, Sam Tingleff 20 Q&A Questions?

21  2002 SAP Labs, LLC, Sam Tingleff 21 No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft®, WINDOWS®, NT®, EXCEL®, Word®, PowerPoint® and SQL Server® are registered trademarks of Microsoft Corporation. IBM®, DB2®, DB2 Universal Database, OS/2®, Parallel Sysplex®, MVS/ESA, AIX®, S/390®, AS/400®, OS/390®, OS/400®, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere®, Netfinity®, Tivoli®, Informix and Informix® Dynamic ServerTM are trademarks of IBM Corporation in USA and/or other countries. ORACLE® is a registered trademark of ORACLE Corporation. UNIX®, X/Open®, OSF/1®, and Motif® are registered trademarks of the Open Group. Citrix®, the Citrix logo, ICA®, Program Neighborhood®, MetaFrame®, WinFrame®, VideoFrame®, MultiWin® and other Citrix product names referenced herein are trademarks of Citrix Systems, Inc. HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology. JAVA® is a registered trademark of Sun Microsystems, Inc. JAVASCRIPT® is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MarketSet and Enterprise Buyer are jointly owned trademarks of SAP Markets and Commerce One. SAP, SAP Logo, R/2, R/3, mySAP, mySAP.com and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are trademarks of their respective companies. Copyright 2002 SAP AG. All Rights Reserved


Download ppt "SAP Web AS – Basics of XML and XSLT Sam Tingleff Technology Product Management, SAP Labs."

Similar presentations


Ads by Google