290 likes | 305 Views
Learn to build high-performance XML applications with Oracle Database 10g, leveraging powerful tools and techniques for efficient XML processing and data exchange.
E N D
Session id: 40020 Building High-PerformanceEnterprise XML Applications with Oracle Database 10g Mark ScardinaGroup Product Manager & XML Evangelist Oracle Corporation
Why You Need XML • Expanding business • XML is widely accepted as the standard data exchange format for B2B, B2C and EAI applications • Moving legacy applications to the Internet • XML incorporates metadata with data facilitating cross platform data exchange • Building e-Business applications over the Internet • XML provides powerful data abstraction for transaction data management and exchange • Publishing content across media and device types • XML provides flexible content representations and easy transformations
Why XML Demands High Performance • Encapsulation of data increase payload size • Standards require character-based processing • XML Schema validation • XSLT stylesheet transformation • XSL transformations require expensive DOM • Content needs data-binding for application processing
Oracle XML Developer’s Kit 10g • High Performance Standards-based libraries and utilities to generate, manipulate, render and store XML • Includes: • XML Parser • XSLT Processor and XSLTVM • XML Schema Processor • XML Class Generators • XML Java Beans • XML SQL Utility • XSQL Servlet • SOAP Services • XML Pipeline Processor • Available for Java, C, and C++ • Available in Servers and free of charge from OTN
Standard Version Language XML 1.0 Java, C/C++ XSLT + XPath XML Namespaces JAXB DOM JAXP SAX + Extensions SOAP XML Schema 1.0 1.0/2.0/3.0 1.0/2.0 1.0 1.0 1.1 1.1 1.0/2.0 Java, C/C++ Java Java, C/C++ Java, C/C++ Java Java, C/C++ Java Java, C/C++ W3C/JSR Standards Support
Oracle XDK 10g: XML to the Power of SQL • Build Oracle 10g XML OCI Applications • Directly access XMLType DOM • Utilize High Performance XSL Transformations • XSLT Compiler and Virtual Machine • Efficiently Generate Large XML documents • Stream-based retrieval • Speed XML Processing with Stream-based XML • One step XML validation and transformation
Build OCI XML DB Applications • New C APIs for working with XMLType • Unified development in/out of Oracle DB 10g • Common XML* C interfaces for XML and XMLType • Eliminates parsing and DOM construction • Fast and Efficient XML processing of DB data • Directly work with the XMLType DOM (XOB) • Eliminates serializing and reparsing
XDK Unified DOM C Code Sample /* Get an xml context */ params[0].name_ocixmldbparam = XCTXINIT_OCIDUR; params[0].value_ocixmldbparam = &dur; xctx = OCIXmlDbInitXmlCtx(envhp, svchp, errhp, params, 1); /* Parse a schema-based document */ if (!(doc = XmlLoadDom(xctx, &err, "buffer", lpxml_test_sch, "buffer_length", sizeof(tlpxml_test_sch)-1, "validate", TRUE, NULL))) /* Create some elements and add them to the document */ top = XmlDomGetDocElem(xctx, doc); foo = (xmlnode *) XmlDomCreateElem(xctx, doc, (oratext *) "FOO"); foo_data = (xmlnode *) XmlDomCreateText(xctx, doc, (oratext *) "data"); foo_data = XmlDomAppendChild(xctx, (xmlnode *) foo, (xmlnode *) foo_data); foo = XmlDomAppendChild(xctx, quux, foo);
Fast XSLT with Oracle XDK10g • XSLT Compiler and VM for C/C++ • Compile Stylesheets for execution in XSLTVM • Improved throughput up to 2.5x • Significant Reduction in Memory use • XSLT 2.0 Support and Optimizations in Java • Optimized Stylesheet compilation based on XML/XSL static analysis • Indexing eliminates expensive XPath navigation • Support for Grouping, Multiple Outputs, Character Mapping, Temp Trees and XSL functions
XSLT Compiler HTML WML XML SVG CSS XML XML XSL XSLTVirtual Machine XSLT Compiler and Virtual Machine
xslbench1 xslbench2 Overall xslbench3 1442 1574 1773 9813 4461 890 654 653 1502 103 408 3125 208 534 13 928 Throughput Performance (KB/s) Result File Size Oracle Oracle Oracle BrandX XSLTVM C Java Java
XSLT Compiler/VM Code Sample xmlFile = (oratext*)argv[1]; xslFile = (oratext*)argv[2]; /* Create context ad initialize */ xctx = XmlCreate(&err, (oratext *) "sample", "data_encoding", "US-ASCII", NULL); comp = XmlXslCreateComp (xctx); vm = XmlXslVMCreate (xctx); /* Compile XSL stylesheet input file */ code = XmlXslCompileFile (comp, xslFile, NULL, XMLXSL_STRIPSPACE, &err); /* Transform XML input file */ len = XmlXslGetBytecodeLength (code, &err); err = XmlXslVMSetBytecodeBuffer (vm, code, len); err = XmlXslVMTransformFile (vm, xmlFile, NULL);
Efficiently Generate Large XML Docs • Print XML directly from SQL Queries • Print Large XML Documents and Result Sets • Easily print directly from SAX events • Extends XML SQL Utility in Oracle XDK 10g • Eliminates the need to create a DOM • No need to create SAX handlers
StartDocument EndDocument StartElement EndElement XML XSU Efficiently Generate Large XML SQL Query Streaming …… JDBC 10g
3K Bytes 35/34 3.72/3.13 300K Bytes 3M Bytes 30M Bytes 38/37 54/37 <100/37 7.91/4.72 37.8/13.4 ?/95.5 Performance Numbers Result Set File Size Memory (MB) Time (s) DOM/SAX DOM/SAX
SAX Print from Query Sample Code //Open a File and Initialize connection and SAX print OutputStream out = new FileOutputStream("out.xml"); DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); conn= DriverManager.getConnection(thinConn,”sh”,”sh”); XMLSAXPrintDriver sample = new XMLSAXPrintDriver(out); //init the OracleXMLQuery OracleXMLQuery qry = new OracleXMLQuery(conn,"select * from sales"); //Print the results qry.getXMLSAX(sample); sample.flush();
Streaming Single-step XML Processing • Create a stream-based XML integration app • Validate and Transform XML messages in a stream-based process • Utilize Oracle Streams 10g messaging support • Annotate XML Schema with mapping attributes • Easily and Efficiently support multiple schemas • Abstract application schema from input schemas future-proofing your application
XML XML XSD SAX SAX XML SchemaProcessor User Applications Query Stream-based XML Processing
D E M O N S T R A T I O N An Open-XML Streaming Business Process Application
Existing DB Application Business • PO Interpretation Validation Input • Relational • Database
Extending DB Application Business SOAP SOAP • PO Interpretation Validation Input SOAP • XML Relational • Database
XMLType Persistence XML Query ProcessingXML Schema Validation XSLT Processing XML Messaging & Queuing Oracle 10g – The High Performance XML Platform OracleASWebCache OracleDBXML Database OracleASJ2EE Client XMLStream XML Stream XMLStream XSLT Processing XML Query ProcessingXML Schema/DTD Validation XML Caching w/ JAAS security XML J2EE ComponentsXML Messaging & Queuing XML Data Integration XSLT ProcessingXML Query Processing XML Caching w/HTTP security XSLT ProcessingXML Query Processing XML Caching w/o security
Next Steps…. • Recommended sessions • 40108: Making XML Technologies Easier to Use • 40255: Manipulating XML with Oracle JDeveloper • Recommended demos and/or hands-on labs • DB: Application Development: XML to the Power of SQL • AS: XML Technologies: Simplify Information Integration • See Your Business in Our Software • Visit the DEMOgrounds for a customized architectural review, see a customized demo with Solutions Factory, or receive a personalized proposal. Visit the DEMOgrounds for more information. • Relevant web sites to visit for more information • XML Technology Center – otn.oracle.com/tech/xml
Oracle XML Resources • Oracle Technology Network • http://otn.oracle.com • Downloads, Demos, Samples, Papers • XML Support Forum • Oracle9i XML Handbook • Covers all of Oracle XML technology • Includes XDK CD with Samples • Available today from Bookstores
Q & Q U E S T I O N S A N S W E R S A
Oracle XML Developer’s Kit 10g XML TO THE POWER OF SQL
Reminder – please complete the OracleWorld online session surveyThank you.