Download presentation
Presentation is loading. Please wait.
Published bySteven Jackson Modified over 8 years ago
3
Leveraging the combined capabilities of Java, XML, and SQL with JDeveloper 9 i Olivier Le Diouris Principal Product Manager Oracle Corporation
4
Agenda Oracle and XML Oracle9i Practices – Core Technology – Storage – Solutions Wrap Up
5
What This Talk *is* and *is not* About Best practices resulting from Oracle9i – New API support to consider – New techniques for XML storage to consider – New development solutions for XML to consider Not Best Practices for XML Standards – Not how-to “ do ” XML Schema – Not how-to “ do ” XML DTD – Not how-to “ do ” XSL
6
Oracle and XML 40+ XML-enabled products across the Oracle9 i platform Oracle9 i : Industry ’ s only complete XML database Oracle9 i AS: Fastest XML enabled middle tier on the market Oracle Internet Developer Suite: Industry ’ s first Java/XML IDE
7
Oracle and XML Standards W3C OMG Java/J2EE RosettaNet OASIS/XML.org ebXML WG Web Services WG (SOAP,WSDL,UDDI)Web Services WG (SOAP,WSDL,UDDI) XMLP WGXMLP WG XML Schema WGXML Schema WG XML Query WGXML Query WG XMI Metadata WGXMI Metadata WG Component Model WGComponent Model WG J2EE Web Services JSRJ2EE Web Services JSR JAXM JSRJAXM JSR JAXM MessagingJAXM Messaging Protocol/JAXPProtocol/JAXP Repository/JAXRRepository/JAXR Messaging/JAXMMessaging/JAXM TPAMLTPAML BOPC WGBOPC WG RNIF WGRNIF WG ®
8
Best Practices Core
9
Oracle XML Developer ’ s Kit Core Standards Support XML Parser XSLT Processor XML Schema Processor Developer Productivity XML Class Generator XML TransviewerBeans Database Integration XML SQL Utility Internet Applications XSQL Servlet/Page Processor March 2001
10
Parsing By DOM Buy Ticker Rating 100 ORCL ***** Rating BuyTicker***** 100ORCL
11
DOM Versus DOM DOM 1.0 - October 1, 1998 – “ … a platform- and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure and style of [XML] documents …” DOM 2.0 - November 13, 2000 – “… with support for XML 1.0 with namespaces and adds supports for Cascading Style Sheets, events (user interface events and tree manipulation events), and enhances tree manipulations …” DOM 3.0 – Under development … – “… add abstract schemas support (for DTDs, XML Schema,...), the ability to load and save a document or an abstract schema …” New in 9i
12
Parsing by SAX start document start element: table start element: tbody start element: tr start element :td characters: Buy end element: td end element: tr start element: td characters: Ticker end element: td start element: td characters: Rating end element: td end element: tr start element: tr start element :td characters: 100 end element: td end element: tr start element: td characters: ORCL end element: td start element: td characters: ***** Buy Ticker Rating 100 ORCL *****
13
SAX versus SAX SAX 1.0 – May 1998 – “… SAX is a standard interface for event-based XML parsing, developed collaboratively by the members of the XML-DEV mailing list ” SAX 2.0 – May 2000 – “… SAX2 is a new version of the popular Simple API for XML, incorporating support for Namespaces, for filter chains, and for querying and setting features and properties in the parser …” New in 9i
14
What about JAXP? XDK 9i, Release 9.0.2 supports JAXP 1.1 for DOM, SAX and XSLT. SAX Parser JAXP Plugability Layer JAXP Interfaces DOM Parser XSL Processor New in 9i
15
Document Type Definitions Buy Ticker Rating 100 ORCL ***** Most common XML Constraint Language
16
XML Schema Buy Ticker Rating 100 ORCL ***** W3C Recommendation on March 30, 2001 New in 9i
17
XML Schema Versus DTD ’ s Oracle XDK 9i supports the XML Schema Recommendation – Available in Java, C and C++ – Support for.XSD files – Support for data types and structures XML Schema becoming dominant – Most new work around XML Schema – XML Schema is significantly richer than DTD – Schema flexibility preferable in new XML applications
18
D E M O N S T R A T I O N XML Basics using the Oracle XML Parser for Java
19
XML and SQL Practices: XML and Oracle9i
20
select * from trans Oracle XML SQL Utility Java,PLSQL, XSQL & Command Buy 100 ORCL 89-344 Sell 100 IBM 89-344 Oracle XML SQL Utility in Action
21
Oracle XML SQL Utility: XML Generation Take select statements, execute them and wrap the results in SQL Available in: – Java- PLSQL – Command line- XSQL Servlet Results available as: – DOM- String – CLOB- SAX – Schema/DTD New in 9i
22
D E M O N S T R A T I O N XML and SQL Oracle9i
23
Oracle XSQL Servlet: Dynamic XML Applications XSQL Servlet Business Logic (BC4J, JMS, JDBC,SOAP) XML Datagram a 1 XML Template a <xsql:action 1 <xsql:action XSL XSLT Processor HTTP XML WML HTML HDML PDF.
24
D E M O N S T R A T I O N An XML Multi- Client Application …
25
I do PLSQL: What About Me? XDK 8i – DOM 1.0 parsing - XSLT 1.0 processing XDK 9i – DOM 2.0 parsing- XSLT 1.0 processing Oracle9i – Built-in XML generation functions – Built-in XMLType with member functions – Soon … C-based PLSQL parser and XSLT
26
Java Versus PLSQL Java – SAX, DOM, JAXP, XSLT available – Typically parsing outside the database – Java in the database only for stored procedures PLSQL – DOM, XSLT available – Parsing inside the database – Robust database functions (XMLType, DBURI type, SYS_XMLGEN, DB_XMLGEN … ) Trade Off: Location, Knowledge, API and Performance
27
D E M O N S T R A T I O N XML Generation: PLSQL in Oracle9i
28
Oracle9i XML Generation DB_XMLGEN in PLSQL for getting XML from SQL queries – Written in C and linked to the server for better performance SQL functions for getting XML from SQL queries – SYS_XMLGEN operates on rows generating XML documents – SYS_XMLAGG operates on groups of rows aggregating several XML documents into one
29
SYS_XMLGEN select sys_xmlgen(employee_id) from employees where last_name like “Scott%”; Highly robust PLSQL XML generation 60
30
SYS_XMLAGG SELECT SYS_XMLAGG(SYS_XMLGEN(last_name), SYS.XMLGENFORMATTYPE.createFormat('EmployeeGroup')). getClobVal() FROM employees GROUP BY department_id; Highly scalable PLSQL XML *aggregration* Scott Mary Jack John>/last_name>
31
XSU Versus XMLGEN and XMLAGG XML SQL Utility – Typically runs outside the database (though can run as stored procedure) – Provides SAX and DOM results – Can run against non-Oracle databases with appropriate JDBC driver DB_XMLGEN, SYS_XMLGEN, SYS_XMLAGG – Highly scalable XML generation inside the database – Primarily a CLOB and string API – Automated XML aggregation functionality
32
Database XML Navigation: Blurring between SQL and XML Use XPath for database XML navigation DBURIType: Access to local data in a database – /scott/emp/row/address/state= ‘ CA ’ HTTPURIType: Access to remote data via HTTP – http://machine.oracle.com/oradb/scott/emp/ro w/address/state= ‘ CA ’ URIType: DBURIType or HTTPURIType
33
DBURIType: The Database as XML 205 Higgins 12000 …
34
Database XML Navigation Create table tax_deductible_po_tab (po_uri UriType, max_deduction number(7,2), po_name varchar2); Insert into tax_deductible_po_tab values ( UriFactory.getURL ( ‘ /scott/po_tab/row[pono=10] ’ ), 2500.00, ‘ Scott DB PO ’ ); Use the UriFactory package to generate URI without handcoding
35
Best Practices Storage
36
XML Storage: Relational and Object Relational Use CLOB, Varchar2, LOB, BLOB – Full relational capabilities kept Leverage object relational – Maps naturally to XML hierarchies Issues regardless of choice – Lose XML context Ordering Original document can be difficult to re-create – Documents often ‘ locked ’ in CLOBs or BLOBs
37
Goals of Oracle9i and XML Storage Make XML a first-class datatype in the database Enable SQL operations on XML Enable XML operations on SQL Provide the basis of a rich content management infrastructure – Storage, Indexing, Searching, Management, Integrity
38
XMLType create table PURCHASEORDER ( PO_ID NUMBER(3), PODOCUMENT sys.xmltype); INSERT INTO PURCHASEORDER values (5, sys.xmltype.createxml(‘ San Francisco Oracle Building XML Applications 35.99 10 ’));
39
Think: XML SQL XMLType FunctionDescription XMLType FunctionDescription getClobValReturn the contents as a CLOB isFragmentGet the String value from the XML node getStringVal Get the string value from the XML node getNumVal Get the numeric value from the XML node extract Extract document portion using XPath existNodeCheck if nodes returned from XPath query yourFunctionFully extensible methods XMLType FunctionDescription XMLType FunctionDescription getClobValReturn the contents as a CLOB isFragmentGet the String value from the XML node getStringVal Get the string value from the XML node getNumVal Get the numeric value from the XML node extract Extract document portion using XPath existNodeCheck if nodes returned from XPath query yourFunctionFully extensible methods
40
What About XML Consistency? create or replace trigger PURCHASEORDERVALIDATION before insert on PURCHASEORDER if (:new.PODOCUMENT.existsnode('//LineItem') > 0) THEN raise MISSING_PARTNUMBER; end if;... Use triggers for full or partial consistency checks Build validation against Schema or DTD
41
What About Indexing and Searching? XML developers want XPath queries – Indexes must optimize XPath expressions Functional indexes enable indexing of XMLType Oracle Text provides arbitrary XML indexing – Varchar2, CLOB, BLOB, XMLType Which way is the best way?
42
Single Document Arbitrary XPath Searching //PurchaseOrder//billto[contains(.’Oracle’)] and //PurchaseOrder//LineItem//book//author [contains(.,’Muench’)] Oracle Building Oracle XML Apps Muench 35.99
43
Oracle8i Text Provided SQL- based Arbitrary XML Searching Multiple Document XML Searches with SQL SELECT * FROM PURCHASEORDER po WHERE CONTAINS(po.doc,‘Oracle WITHIN BillTo') > 0 AND CONTAINS(po.doc,‘Muench WITHIN author') > 0 AND... /* Other where Clauses */ Oracle Building Oracle XML Apps Muench 35.99
44
Oracle9i Text Provides XPath- based Arbitrary XML Searching Multiple Document XML Searches with XPath SELECT * FROM PurchaseOrder po WHERE Contains(po.doc,’Oracle INPATH (PurchaseOrder/BillTo)’) > 0 AND CONTAINS(po.doc,’Muench INPATH (PurchaseOrder/LineItem/book/author)’) > 0 AND... Oracle Building Oracle XML Apps Muench 35.99
45
Oracle9i XMLType: Functional Indexes Build functional indexes on XMLType using XMLType functions create unique index IPURCHASEORDERREFERENCE on PURCHASEORDER PO (substr(sys.xmlType.getStringVal(sys.xmlType.extract(PO. PODOCUMENT,'/PurchaseOrder/BillTo/text()')),1,40)); Select PO.DOC from PURCHASEORDER PO where sys.xmlType.getStringVal(sys.xmlType.extract(PO.DOC,’Pur chaseOrder/BillTo/text()’),40)) = ‘Oracle’
46
Indexing Comparison: Complementary Approaches Oracle Text – Arbitrary XML searches – Rich XPath implementation – Brings linguistic heritage Functional Indexes – Specific XML searches – Utilize built-in XMLType or custom functions – Not as rich an XPath implementation
47
D E M O N S T R A T I O N Searching XML documents in Oracle 9i
48
D E M O N S T R A T I O N XML in Oracle9i
49
Best Practices Development Solutions
50
Oracle 9i Application Server Collaborate with your Stakeholders Extract Business Intelligence Accelerate Web Site Performance withCaching WirelessEnablePortals CreatePersonalizedPortals Build and Deploy Dynamic Web Sites and Internet Applications IntegrateYourBusiness J2EE and XML Core
51
Oracle9 i AS Integration Services and XML App2 App1 Adapter Adapter Metadata XML Oracle8 i XML Workflow Business Event Advanced Queuing Oracle 9iAS AQ Hub An integration framework built for B2B and A2A integration Shipping adapters to ERP and CRM vendors
52
Oracle9i AS Wireless Edition and XML Any Markup HTML XML HDML WML TinyHTML TTML CHTML STKML VoXML VoiceXML …. Oracle9i AS WirelessEdition Any Device Nokia Motorola Ericsson Palm RIM Pagers Blackberry Any Network ….. Any Browser Any Gateway Nokia Motorola Ericsson Phone.com CMG Tantau Infinity ... Personalized By User By Group By Device By Location By Language ... Any Content Any Web Site Any HTML Page Any XML Page Any Database Any servlet Any JSP Any XSP Any e-mail ...
53
Oracle9iAS Portal: Consume Syndicated XML Content Oracle9iAS Portal 1.0.2.2: Declarative XML consumption
54
Oracle9iAS Business Intelligence and XML Oracle9iAS Reports – Leverage existing reports by outputting XML – Define report definitions in XML Oracle9iAS Discoverer – Underlying infrastructure is XML driven – Opportunity to customize business intelligence to mobile devices
55
Oracle9i JDeveloper: XML Support Schema Driven XML Editor Integrated Oracle XDK for Java – Parser, XSLT Transformer, SQL utility – XSQL pages – Run and Debug inside the IDE – XML Schema support Application Integration – XML Messaging via JMS – Built-in web service development Web Services – Discover, Bind, Invoke, Publish
56
D E M O N S T R A T I O N XML Solutions for Developers
57
Agenda Oracle9i and XML Best Practices Core Technology Storage Development Wrap Up
58
WIN A FREE CONFERENCE PASS TO ORACLE OPENWORLD SAN FRANCISCO! We want to know what you think! Fill out the survey that was handed out at the beginning of the session for a chance to win a full conference pass to Oracle OpenWorld San Francisco 2001 Remember to include your name and email in the comments section
59
A Q & Q U E S T I O N S A N S W E R S
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.