oracle8i · oracle8i oracle8i application developer’s guide - xml release 3 (8.1.7) september...

1264
Oracle8i Oracle8i Application Developer’s Guide - XML Release 3 (8.1.7) September 2000 Part No. A86030-01

Upload: others

Post on 06-Aug-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

  • Oracle 8i

    Oracle8i Application Developer’s Guide - XML

    Release 3 (8.1.7)

    September 2000

    Part No. A86030-01

  • Oracle8i Application Developer’s Guide -XML, Release 3 (8.1.7)

    Part No. A86030-01

    Copyright © 1996, 2000, Oracle Corporation. All rights reserved.

    Primary Author: Shelley Higgins

    Graphics: Valerie Moore

    Contributing Authors: Sandeepan Banerjee, Kishore Bhamidipati, Stefan Buchta, Dipto Chakravarty(Artesia Technologies, Inc.), Robert Dell’immagine, Brajesh Goyal, Robert Hall, Karun K, StefanKiritzo,Vishu Krishnamurthy, Murali Krishnaprasad, Olivier LeDiouris, Bryn Llewellen, Roger Medlin(Artesia Technologies, Inc.), Steve Muench,Visar Nimani, Paul Nock, Rajesh Raheja, Tomas Saulys, MarkScardina, Flora Sun, Prabhu Thukkaram

    Contributors: Ari Adler, Omar Alonso, Phil Bates, Mark Bauer, Ravinder Booreddy, Steve Cave, SteveCorbett, Claire Dessaux, Janet Lee, Shailendra Mishra, Andy Page, Rahul Pathak, Padmini Ranganathan,Den Raphaely, Jim Rawles, David Saslav, Chitra Sharma, Ena Singh, Keith Swartz, Kurt Thompson,Melanie Watson, Jon Wilkinson

    The Programs (which include both the software and documentation) contain proprietary information ofOracle Corporation; they are provided under a license agreement containing restrictions on use anddisclosure and are also protected by copyright, patent, and other intellectual and industrial propertylaws. Reverse engineering, disassembly, or decompilation of the Programs is prohibited.

    The information contained in this document is subject to change without notice. If you find any problemsin the documentation, please report them to us in writing. Oracle Corporation does not warrant that thisdocument is error free. Except as may be expressly permitted in your license agreement for thesePrograms, no part of these Programs may be reproduced or transmitted in any form or by any means,electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation.

    If the Programs are delivered to the U.S. Government or anyone licensing or using the programs onbehalf of the U.S. Government, the following notice is applicable:

    Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercialcomputer software" and use, duplication, and disclosure of the Programs, including documentation,shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement.Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computersoftware" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500Oracle Parkway, Redwood City, CA 94065.

    The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherentlydangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup,redundancy, and other measures to ensure the safe use of such applications if the Programs are used forsuch purposes, and Oracle Corporation disclaims liability for any damages caused by such use of thePrograms.

    Oracle is a registered trademark, and Oracle Press®, Oracle8i TM, PL/SQL ™ , Pro*C ™ , Pro*C/C++ ™ ,Pro*COBOL®, SQL*Plus® , JDeveloper™, JServer™, Oracle® Discoverer™,SQL*Loader®, Oracle/2000™ are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks oftheir respective owners.

    Other trademarks used in this manual are TEAMS™ of Artesia Technologies, Inc.

  • Contents

    Send Us Your Comments ............................................................................................................. xxxix

    Preface ........................................................................................................................................................... xli

    About this Guide.................................................................................................................................. xliiIntended Audience .............................................................................................................................. xliiiPrerequisite Knowledge...................................................................................................................... xliiiRelated Manuals................................................................................................................................... xliiiFeature Coverage and Availability ................................................................................................... xliiiHow this Book is Organized .............................................................................................................. xliiiConventions Used in this Guide...................................................................................................... xlviiAcronym List ...................................................................................................................................... xlviiHow to Order this Manual ................................................................................................................ xlix

    Part I Introducing Oracle XML

    1 Introduction to Oracle XML

    Introduction ......................................................................................................................................... 1-3Oracle XML in Action: Applications............................................................................................... 1-3

    Authored XML or Generated XML............................................................................................ 1-3Oracle XML Applications............................................................................................................ 1-3

    Roadmap of this Manual ................................................................................................................... 1-5Oracle XML .......................................................................................................................................... 1-7

    What is Oracle XML? ................................................................................................................... 1-7Oracle XML Components ............................................................................................................ 1-7

    iii

  • When to Use Oracle XML Components: How They Work Together.................................. 1-10Oracle8i XML Features............................................................................................................... 1-10

    Why Use Oracle8i XML?.................................................................................................................. 1-13The Oracle Suite of Integrated Tools ............................................................................................ 1-13

    Oracle JDeveloper 3.2 and Oracle Business Objects for Java (BC4J) ................................... 1-13Internet File System (iFS) ........................................................................................................... 1-14Portal (webDB) ............................................................................................................................ 1-14Oracle Exchange.......................................................................................................................... 1-15Other Initiatives .......................................................................................................................... 1-15Indexing and Searching XML Documents with Oracle interMedia Text............................ 1-16Messaging Hubs and Middle Tier Components .................................................................... 1-16Back-End to Database to Front-End Integration Issues ........................................................ 1-17Oracle XML Parser Provides the Two Most Common APIs: DOM and SAX.................... 1-18Writing Custom XML Applications ......................................................................................... 1-18Loading XML into a Database .................................................................................................. 1-19

    Storing and Extracting XML Data from Oracle8i........................................................................ 1-20Oracle8i: Object-Relational Infrastructure .................................................................................. 1-20Oracle8i: Extensible Architecture .................................................................................................. 1-20

    Oracle8i Supports Native Java.................................................................................................. 1-21XML in the Database: Generated and Authored XML .............................................................. 1-23

    Generated XML........................................................................................................................... 1-23Example: Using XML-SQL Utility to Get the XML Representation of the Result of an SQL Query ............................................................................................................................. 1-23

    XML Storage Options....................................................................................................................... 1-26LOB Storage: Stores "Authored XML" Documents................................................................ 1-26Object-Relational Storage: Stores "Generated XML" Documents ........................................ 1-26

    Storage of Structured XML Documents ("Generated XML").................................................... 1-27XML-SQL Utility Stores XML Data By Preserving XML Structure..................................... 1-27Example: Using XML-SQL Utilitiy’s JAVA API to Insert XML into the Database ........... 1-27XML Document Object-Relational Storage: Advantages...................................................... 1-28XML Document Object-Relational Storage: Disadvantages................................................. 1-28

    Storage of Unstructured XML Documents ("Authored XML") ................................................ 1-29interMedia Text Example: Searching Text and XML Data Using CONTAINS.................. 1-29

    Use a Hybrid Storage Approach for Better Mapping Granularity .......................................... 1-30A Hybrid Approach Allows for User-Defined Granularity for Storage............................. 1-30

    iv

  • Hybrid Storage Advantages...................................................................................................... 1-31Generated XML: XML Transformations ....................................................................................... 1-32

    Transforming Query Results Using XSLT .............................................................................. 1-32XML Schemas and Mapping of Documents................................................................................ 1-32

    XML Schema Example 1: Defining a Simple Data Type....................................................... 1-33XML Schema Example 2: Using XML Schema to Map Generated XML Documents to Underlying Schema .............................................................................................................. 1-33

    "Authored XML": Storing XML Documents as Documents ..................................................... 1-36Generating and Storing XML Documents ................................................................................... 1-37

    Combining XML Documents and Data Using Views ........................................................... 1-38How to Generate a Web Form’s Infrastructure...................................................................... 1-38XML-SQL Utility Storage .......................................................................................................... 1-38

    General XML Design Issues for Data Exchange Applications ................................................ 1-40Use a Hybrid Storage Approach for Better Mapping Granularity.......................................... 1-41Sending XML Data from a Web Form to a Database ................................................................. 1-41Communicating XML Documents Among Applications.......................................................... 1-42Oracle XML Samples and Demos .................................................................................................. 1-43What’s Needed to Run Oracle XML Components ...................................................................... 1-43XML Technical Support is Free on OTN ...................................................................................... 1-43

    2 Business Solutions Using Oracle XML

    Applications that Use Oracle XML.................................................................................................. 2-2Content and Document Management............................................................................................. 2-3

    Customizing Presentation of Data ............................................................................................. 2-3Scenario 1. Content and Document Management: Creating and Publishing CompositeDocuments Using Oracle XML ........................................................................................................ 2-6Scenario 2. Content and Document Management: Delivering Personalized Information Using Oracle XML .......................................................................................................................... 2-8Scenario 3. Content Management: Using XML to Customize Data Driven Applications.. 2-10Business-to-Business/Consumer (B2B/B2C) Messaging ........................................................... 2-11

    Business-to-Business/Consumer (B2B/B2C) Messaging With XML: Scenarios............... 2-11Scenario 4. B2B Messaging: Online Multivendor Shopping Cart Design Using XML ...... 2-12Scenario 5. B2B Messaging: Using XML and Oracle Advanced Queueing for a Internet Application ..................................................................................................................... 2-14

    v

  • Scenario 6. B2B Messaging: Using XML and Oracle Advanced Queueing Messaging forMulti-Application Integration........................................................................................................ 2-16

    3 Oracle XML Components and General FAQs

    Oracle XML Components: Overview .............................................................................................. 3-2Development Tools and Other XML-Enabled Oracle8i Features .............................................. 3-2

    XDK for Java.................................................................................................................................. 3-3XDK for C....................................................................................................................................... 3-3XDK for C++.................................................................................................................................. 3-3XDK for PL/SQL........................................................................................................................... 3-4

    XML Parsers ......................................................................................................................................... 3-4XSL Transformation (XSLT) Processor............................................................................................ 3-6XML Class Generator ......................................................................................................................... 3-6XML Transviewer Java Beans ........................................................................................................... 3-7Oracle XSQL Page Processor and Servlet ....................................................................................... 3-8

    Servlet Engines that Support XSQL Servlet ........................................................................... 3-8JavaServer Pages (JSP) Platforms that Support XSQL Servlet ............................................... 3-9

    Oracle XML-SQL Utility (XSU) ...................................................................................................... 3-12Generating XML from Query Results...................................................................................... 3-13XML Document Structure: Columns Are Mapped to Elements .......................................... 3-13

    Oracle interMedia Text..................................................................................................................... 3-15Tools for Building Oracle XML Applications.............................................................................. 3-16Oracle XML Components: Generating XML Documents ......................................................... 3-17Using Oracle XML Components to Generate XML Documents: Java .................................... 3-17Using Oracle XML Components to Generate XML Documents: C ......................................... 3-19Using Oracle XML Components to Generate XML Documents: C++ ................................... 3-21Using Oracle XML Components to Generate XML Documents: PL/SQL ............................. 3-23Frequently Asked Questions (FAQs) - General XML ................................................................ 3-25

    How do I Start Writing XML?................................................................................................... 3-25XML and Required Oracle Tools .............................................................................................. 3-25Collecting Purchase Orders in XML: Creating an RFP in XML? ......................................... 3-26Portability: Using Parsers from Different Vendors?.............................................................. 3-27Browsers that Support XML...................................................................................................... 3-27XML Support for Oracle 8.0.x ................................................................................................... 3-28EDI and XML............................................................................................................................... 3-28

    vi

  • What Oracle Tools Support B2B Exchanges? ......................................................................... 3-29Oracle’s Direction Regarding XML?........................................................................................ 3-30XML and BLOB (inside XML message)................................................................................... 3-31Maximum CLOB Size?............................................................................................................... 3-31Oracle 7.3.4: Data Transfers to Other Vendors Using XML ................................................. 3-31What Do I Need to Insert Data Into Tables Via XML?.......................................................... 3-32Building an XML Application: Software Needed? ................................................................ 3-32Standard DTDs to Use for Orders, Shipment,... ..................................................................... 3-33DTD to Database Schema .......................................................................................................... 3-34Schema Map to XML.................................................................................................................. 3-34XML in the Database: Performance ......................................................................................... 3-35Faster Record Retrievals ............................................................................................................ 3-35Translating From Other Formats to XML ............................................................................... 3-35XML File Size Limitations ......................................................................................................... 3-36Maximum Size XML Document? ............................................................................................. 3-36Generating Database Schema From a Rational Rose Tool.................................................... 3-36

    Further References............................................................................................................................ 3-37Other XML FAQs........................................................................................................................ 3-37Recommended XML/XSL Books ............................................................................................. 3-37

    Part II XML-SQL Utility (XSU): Storing and Retrieving XML From the Database

    4 Using XML-SQL Utility (XSU)

    Accessing XML-SQL Utility ............................................................................................................. 4-3Using XML-SQL Utility (XSU) ......................................................................................................... 4-4

    When to Use XML-SQL Utility (XSU) ....................................................................................... 4-4Where Can You Run XML-SQL Utility (XSU)? ............................................................................. 4-6

    Running XML-SQL Utility in the Database .............................................................................. 4-6Running XML-SQL Utility in the Middle Tier ......................................................................... 4-7Running XML-SQL Utility in a Web Server ............................................................................. 4-8What Does XML-SQL Utility Work With?................................................................................ 4-9XSU Features ................................................................................................................................. 4-9

    XSU Usage Guidelines..................................................................................................................... 4-11Mapping Primer ................................................................................................................................ 4-11

    Mapping: Generating XML from SQL..................................................................................... 4-11

    vii

  • Mapping: Storing SQL from XML............................................................................................ 4-14Client-Side: XSU Command Line Usage ...................................................................................... 4-16Generating XML with XSU: getXML ............................................................................................ 4-17Storing XML: putXML...................................................................................................................... 4-19XML-SQL Utility for Java................................................................................................................ 4-21

    Generating XML.......................................................................................................................... 4-21XSU: Basic Generation of XML From SQL Queries ............................................................... 4-21XSU Example 1: Generating a String From emp table .......................................................... 4-22XSU Example 2: Generating DOM From emp table (Java)................................................... 4-25

    Paginating Results: skipRows and maxRows ............................................................................. 4-27XSU Example 3. Paginating Results: Generating an XML Page When Called (Java) ....... 4-28

    Generating XML from ResultSet Objects .................................................................................... 4-30XSU Example 4: Generating XML from JDBC ResultSets (Java) ......................................... 4-30XSU Example 5: Generating XML from Procedure Return Values (REF CURSORS) (Java) .......................................................................................................... 4-31

    Raising No Rows Exception............................................................................................................ 4-33XSU Example 6: No Rows Exception (Java)............................................................................ 4-34

    Storing XML ....................................................................................................................................... 4-34Insert Processing ............................................................................................................................... 4-35

    XSU Example 7: Inserting XML Values into all Columns (Java) ......................................... 4-35XSU Example 8: Inserting XML Values into Only Certain Columns (Java)....................... 4-37

    Update Processing............................................................................................................................. 4-38XSU Example 9: Updating Using the keyColumns (Java) .................................................... 4-38XSU Example 10: Updating a Specified List of Columns (Java) .......................................... 4-39

    Delete Processing .............................................................................................................................. 4-41XSU Example 11: Deleting Operations Per ROW (Java) ....................................................... 4-41XSU Example 12: Deleting Specified Key Values (Java) ....................................................... 4-42

    Using the XML-SQL Utility for PL/SQL ...................................................................................... 4-43Generating XML with DBMS_XMLQuery.............................................................................. 4-43XSU Example 13: Generating XML From Simple Queries (PL/SQL)................................. 4-43XSU Example 13a: Printing CLOB to Output Buffer ............................................................. 4-44XSU Example 14: Changing ROW and ROWSET Tag Names (PL/SQL) .......................... 4-44XSU Example 15: Paginating Results Using setMaxRows() and setSkipRows() ............... 4-45

    Setting Stylesheets in XSU (PL/SQL)............................................................................................ 4-46

    viii

  • Binding Values in XSU (PL/SQL) .................................................................................................. 4-46XSU Example 15a: Binding Values to the SQL Statement .................................................... 4-47

    Storing XML in the Database Using DBMS_XMLSave ............................................................ 4-48XSU Insert Processing in PL/SQL.................................................................................................. 4-49

    XSU Example 16: Inserting Values into All Columns (PL/SQL)......................................... 4-49XSU Example 17: Inserting Values into Only Certain Columns (PL/SQL) ....................... 4-50

    Update Processing ............................................................................................................................ 4-51XSU Example 18: Updating an XML Document Using keyColumns(PL/SQL) ............... 4-51XSU Example 19: Specifying a List of Columns to Update (PL/SQL) ............................... 4-52

    Delete Processing.............................................................................................................................. 4-53XSU Example 20: Deleting Operations per ROW (PL/SQL)................................................ 4-53XSU Example 21: Deleting by Specifying the Key Values (PL/SQL) ................................. 4-54XSU Example 22: ReUsing the Context Handle (PL/SQL) .................................................. 4-55

    Advanced Usage Techniques .......................................................................................................... 4-57Exception Handling in Java ...................................................................................................... 4-57Exception Handling in PL/SQL ............................................................................................... 4-58

    Frequently Asked Questions (FAQs): XML-SQL Utility (XSU) .............................................. 4-60What Schema Structure to Use With XSU to Store XML? .................................................... 4-60Storing XML Data Across Tables ............................................................................................. 4-61Using XML-SQL Utility to Load XML Stored in Attributes................................................. 4-62XML-SQL Utility is Case Sensitive: Use ignoreCase or... ..................................................... 4-62Generating Database Schema from a DTD ............................................................................. 4-63Using XML-SQL Utility Command Line................................................................................. 4-63Does XML-SQL Utility Commit After INSERT, DELETE, UPDATE? ................................ 4-63

    Part III Managing Content and Documents with XML

    5 Using inter Media Text to Search and Retrieve Data from XML Documents

    Introducing interMedia Text............................................................................................................. 5-3Overview of interMedia Text............................................................................................................ 5-3Installing interMedia Text................................................................................................................. 5-4interMedia Text Users and Roles ..................................................................................................... 5-4Querying with the CONTAINS Operator...................................................................................... 5-5

    CONTAINS Example 1 ................................................................................................................ 5-6CONTAINS Example 2: Using Score Operator with a Label .................................................. 5-6

    ix

  • CONTAINS Example 3: Using the SCORE Operator ............................................................... 5-6Assumptions Made in this Chapter’s Examples ........................................................................... 5-6Using interMedia Text to Search XML Documents ..................................................................... 5-8interMedia Text Indexes..................................................................................................................... 5-8Using the CTX_DDL PL/SQL Package ........................................................................................... 5-9

    Listing the Required Roles for Each CTX Package .................................................................. 5-9CTX_DDL Procedures................................................................................................................ 5-10XML_SECTION_GROUP Attribute Sections.......................................................................... 5-11AUTO_SECTION_GROUP ....................................................................................................... 5-13

    Creating an interMedia Text Index ................................................................................................ 5-141 Determine the Role you Need and GRANT ctxapp Privilege....................................... 5-142 Set up Data, if Not Already Available .............................................................................. 5-143 Creating an interMedia Text Index in Order to use CONTAINS ................................. 5-154 Creating a Preference: You Need to Express the Parameterization with a "Preference".................................................................................................................... 5-155 Parameterizing the Preference ........................................................................................... 5-16interMedia Text Example 1: Creating an Index — Creating a Preference and Correctly Parameterizing it .................................................................................................. 5-17interMedia Text Example 2: Creating a Section Group with AUTO_SECTION_GROUP 5-18interMedia Text Example 3: Creating a Section Group with XML_SECTION_GROUP .. 5-18Further Examples for Creating Section Group Indexes? ...................................................... 5-19

    Building Query Applications with interMedia Text .................................................................. 5-20Text Query Expression ..................................................................................................................... 5-20

    interMedia Text Example 4: Using Text Query Expressions ................................................ 5-20Querying with Attribute Sections ................................................................................................. 5-28

    Constraints for Querying Attribute Sections .......................................................................... 5-28Querying SECTION GROUPS ...................................................................................................... 5-30

    Distinguishing Tags Across DocTypes.................................................................................... 5-30Specifying Doctype Limiters to Distinguish Between Tags ................................................. 5-30Doctype-Limited and Unlimited Tags in a Section Group................................................... 5-31

    Procedure for Building a Query Application with interMedia Text ....................................... 5-32Using Table CTX_OBJECTS and CTX_OBJECT_ATTRIBUTES View ................................ 5-32

    1 Create a Preference ........................................................................................................................ 5-332 Set the Preference’s Attributes .................................................................................................... 5-34

    2.1 Using CTX_DDL.add_zone_section................................................................................. 5-34

    x

  • 2.2 Using CTX_DDL.Add_Attr_Section.................................................................................. 5-352.3 Using CTX_DDL.add_field_section................................................................................... 5-362.4 Using CTX_DDL.add_special_section............................................................................. 5-382.5 Using CtX_DDL.Add_Stop_Section ................................................................................ 5-38

    3 Creating Your Query Syntax ..................................................................................................... 5-39interMedia Text Example 4: Querying a... Document........................................................... 5-40interMedia Example 5: Creating an Index and Performing a Text Query ......................... 5-41

    Creating Sections in XML Documents that are Document Type Sensitive .......................... 5-44Repeated Sections ....................................................................................................................... 5-44Overlapping Sections ................................................................................................................. 5-45Nested Sections ........................................................................................................................... 5-45

    Presenting the Results of Your Query .......................................................................................... 5-46Frequently Asked Questions (FAQs): interMedia Text ............................................................. 5-47

    Inserting XML data and Searching with interMedia Text .................................................... 5-47interMedia Text: Handling Attributes..................................................................................... 5-47CTXSYS/CTXSYS id and password ........................................................................................ 5-48Querying an XML Document ................................................................................................... 5-48interMedia Text and Oracle8i.................................................................................................... 5-49interMedia XML Indexing ......................................................................................................... 5-50Searching CLOBs Using interMedia Text................................................................................ 5-50Managing Different XML Documents With Different DTDs: Storing and Searching XML in CLOBs -- interMedia Text ....................................................................................... 5-51interMedia Text Role (ORA-01919: role ’CTXSYS’ does not exist) ...................................... 5-53Searching XML Documents and Returning a Zone............................................................... 5-53Storing an XML Document in CLOB: Using interMedia Text.............................................. 5-54Loading XML Documents into the Database and Searching with interMedia Text ......... 5-56Searching XML with WITHIN Operator................................................................................. 5-56interMedia Text and XML.......................................................................................................... 5-57interMedia Text and XML: Add_field_section ....................................................................... 5-57interMedia and XML Support ................................................................................................... 5-58Oracle8i Lite 4.0.0.2.0: interMedia Text is Not Supported .................................................... 5-60SQL in interMedia context ......................................................................................................... 5-61XML and interMedia Text.......................................................................................................... 5-61Creating an Index on Three Columns?.................................................................................... 5-62 Searching Structured and Unstructured Data....................................................................... 5-62

    xi

  • 6 Customizing Content with XML: Dynamic News Application

    Introduction to the Dynamic News Application .......................................................................... 6-2Dynamic News Main Tasks ............................................................................................................. 6-2Overview of the Dynamic News Application ............................................................................... 6-2Dynamic News SQL Example 1: Item Schema, nisetup.sql ....................................................... 6-4Dynamic News Servlets..................................................................................................................... 6-4How Dynamic News Works: Bird’s Eye View ............................................................................... 6-5Static Pages ........................................................................................................................................... 6-7Semi-Dynamic Pages.......................................................................................................................... 6-9Dynamic Pages .................................................................................................................................. 6-11Personalizing Content...................................................................................................................... 6-131 Get End-User Preferences............................................................................................................ 6-14

    From a Client-Side Cookie......................................................................................................... 6-14Querying the Database............................................................................................................... 6-15

    2 Pull News Items from the Database......................................................................................... 6-183 Combine News Items to Build a Document ........................................................................... 6-204 Customizing Presentation .......................................................................................................... 6-21Importing and Exporting News Items .......................................................................................... 6-24

    7 Personalizing Data Display With XML: Portal-to-Go

    Introduction to Oracle Portal-to-Go ................................................................................................ 7-2Portal-To-Go 1.0.2 Features................................................................................................................ 7-3What’s Needed to Run Portal-to-Go ................................................................................................ 7-3Portal-To-Go: Supported Devices and Gateways ......................................................................... 7-4How Portal-to-Go Works ................................................................................................................... 7-5Portal-to-Go Components ................................................................................................................. 7-6

    Portal-to-Go Services.................................................................................................................... 7-6Portal-to-Go Adapters.................................................................................................................. 7-7Portal-to-Go Transformers .......................................................................................................... 7-8

    Exchanging Data via XML: Source to XML, XML to Target with Portal-to-Go....................... 7-9Extracting Content ............................................................................................................................ 7-10

    Web Integration Developer: A "Screen Scraper" .................................................................... 7-11Converting to XML ........................................................................................................................... 7-13

    Why Use an Intermediate XML Format? ................................................................................ 7-13Using the Simple Result DTD ................................................................................................... 7-13

    xii

  • Adapters Map the Source Content to the DTD Element ...................................................... 7-16Sample Adapter Classes .................................................................................................................. 7-18

    Portal-to-Go Adapter Example 1: Converts Stock Quotes and Headlines to XML .......... 7-18Portal-to-Go Adapter Example 2: Greets Users by Name .................................................... 7-19

    Transforming XML to the Target Markup Language ................................................................. 7-23Portal-to-Go: Java Transformers..................................................................................................... 7-24

    Portal-to-Go Java Transformer Example 1: Converting Simple Result Elements to Another Format....................................................................................................................... 7-24

    Portal-to-Go: XSL Stylesheet Transformers ................................................................................. 7-27Portal-to-Go XSL Stylesheet Transformer Example 1: Converting Simple Resu Documents to Plain Text........................................................................................................ 7-27Each Markup Language Requires a Unique Transformer.................................................... 7-28Portal-To-Go Stylesheet Transformer Example 2: Customizing a WML1.1 Transformer Stylesheet .......................................................................................................... 7-30

    Portal-to-Go Case Study 1: Extending Online Drugstore’s Reach .......................................... 7-31Portal-to-Go Case Study 2: Expanding Bank Services............................................................... 7-31

    8 Customizing Presentation with XML and XSQL: Flight Finder

    XML Flight Finder Sample Application: Introduction................................................................ 8-2Required Software.............................................................................................................................. 8-2How Flight Finder Works .................................................................................................................. 8-3Flight Finder Queries the Database — Converts Results to XML............................................. 8-6

    Using XSQL Servlet to Process Queries and Output Result as XML.................................... 8-6Formatting XML with Stylesheets ................................................................................................ 8-10

    One Stylesheet, One Target Device.......................................................................................... 8-10Many Stylesheets, Many Target Devices................................................................................. 8-12Localizing Output....................................................................................................................... 8-14

    XML to Database............................................................................................................................... 8-181 Taking the User’s Input ........................................................................................................ 8-182 Assign Values Acquired From User to Code Parameters................................................ 8-203 Let User Know if Operation Succeeded ............................................................................. 8-20

    Oracle Portal-to-Go........................................................................................................................... 8-22

    xiii

  • Part IV Data Exchange Using XML

    9 Using Oracle Advanced Queuing (AQ) in XML Data Exchange

    What is AQ? ......................................................................................................................................... 9-2How do AQ and XML Complement Each Other?......................................................................... 9-2AQ Example 1 (PL/SQL): XML Message as a CLOB in an AQ Message ................................. 9-4

    Setting Up the AQ Environment ................................................................................................ 9-4AQ Example 1: Tasks Performed................................................................................................ 9-5AQ Example 1: The PL/SQL Code ........................................................................................... 9-5

    AQ Example 2 (Java): Processing an XML Message Using JMS (Publish - Subscribe)......... 9-8AQ Example 2: Processing an XML Message Using JMS —Tasks Performed .................... 9-8AQ Example 2: Processing an XML Message Using JMS — Java Code ............................... 9-9

    Frequently Asked Questions (FAQs): XML and Advanced Queuing..................................... 9-11Multiple Format Messages: Create an Object Type and Store as Single Message ............ 9-11Adding New Recipients After Messages are Enqueued....................................................... 9-12XML and AQ ............................................................................................................................... 9-12Retrieving and Parsing JMS Clients with XML Content From AQ..................................... 9-13Ensuring that an Enqueue is Successful? ................................................................................ 9-14

    10 B2B: How iProcurement Uses XML to Offer Multiple Catalog Products toUsers

    Introduction to Oracle Internet Procurement (iProcurement).................................................. 10-2Various Suppliers Load Their Catalogs into the Unified Catalog Tables .......................... 10-2Oracle Internet Procurement Solution..................................................................................... 10-2More Information About Internet Procurement and Related Products ............................. 10-3Buyer-Hosted Content ............................................................................................................... 10-3Supplier-Hosted Catalogs and Marketplaces ......................................................................... 10-4

    iProcurement: XML Parser for Java ............................................................................................... 10-6Buyer-Hosted Catalogs .................................................................................................................... 10-9

    Document Type Definition (DTD) ........................................................................................... 10-9iProcurement Example 1: DTD for Buyer-Hosted Catalog ................................................ 10-10

    DTD Admininistrative Information: ..................................................................... 10-11

    xiv

  • DTD Schema Information: ................................................................................... 10-11iProcurement Example 2: DTD — Adding a Category and Descriptor to the Category..................................................................................................................... 10-13iProcurement Example 3: DTD : Deleting a Category or Descriptor.......... 10-14iProcurement Example 4: DTD — Updating Category or Descriptor....... 10-14

    DTD: Item Information ................................................................................................................. 10-15iProcurement Example 5: DTD ITEM — Adding Items Using ..................................................................................................... 10-16iProcurement Example 6: DTD ITEM — Deleting Items Using ............................................................................................ 10-17iProcurement Example 7: DTD ITEM — Updating Items Using

  • Authenticated XML Schema ......................................................................................................... 10-45iProcurement Example 13: Authenticated XML Schema — Returned Requisition User XML Document........................................................................................................... 10-45iProcurement Example 14: Authenticated User: Sample Returned XML Document ..... 10-46

    Unauthenticated XML Schema..................................................................................................... 10-47iProcurement Example 15: Unauthenticated User — XML Schema ................................. 10-47iProcurement Example 16: Unauthenticated User — Sample XML document............... 10-47

    11 Customizing Discoverer 3i Viewer with XSL

    Discoverer3i Viewer: Overview ..................................................................................................... 11-2Discoverer 3i Viewer: Features ....................................................................................................... 11-3Discoverer 3i Viewer: Architecture................................................................................................ 11-4How Discoverer 3i Viewer Works.................................................................................................. 11-5

    Replicating Discoverer Application Server............................................................................. 11-6Using Discoverer 3i Viewer for Customized Web Applications ............................................. 11-7

    Step 1: Browser Sends URL ....................................................................................................... 11-7Step 2: Servlet Generates XML.................................................................................................. 11-7Discoverer XML Example 1: Three Workbook Report Data ............................................... 11-8Step 3: XSL-T Processor Applies an XSL Stylesheet .............................................................. 11-8Step 4: XSL-T Processor Generates HTML.............................................................................. 11-8

    Customizing Style by Modifying an XSL Stylesheet File: style.xsl...................................... 11-10Discoverer 3i Viewer: Customization Example Using XML and XSL .................................. 11-10

    Step 1: The XML File................................................................................................................. 11-10Step 2: XSL File, example1.xsl ................................................................................................. 11-11Step 3: XML+XSL = HTML...................................................................................................... 11-12Step 4: Customizing the XSL Stylesheet (example2.xsl)...................................................... 11-13

    Frequently Asked Questions (FAQs): Discoverer 3i Viewer .................................................. 11-18Explaining Servlets ................................................................................................................... 11-18How Discoverer 3i Viewer Communicates with Browsers ................................................ 11-18Why HTML is Output to the Browser ................................................................................... 11-19Discoverer 3i Viewer and XML............................................................................................... 11-19disco3iv.xml............................................................................................................................... 11-19Discoverer 3i and XSL.............................................................................................................. 11-20Supported XSL-T Processors................................................................................................... 11-20Specifying the XSL-T Processor in the Servlet’s Classpath................................................. 11-20

    xvi

  • XSL Editors ................................................................................................................................ 11-21Customizing Stylesheets.......................................................................................................... 11-21Viewing Changes to a Modified Stylesheet .......................................................................... 11-22Browser Displays Blank Screen .............................................................................................. 11-22More information on XML and XSL ...................................................................................... 11-23

    12 Phone Number Portability Using XML Messaging

    Introduction to Phone Number Portability Messaging ............................................................ 12-2Requirements for Building a Phone Number Portability Application ............................... 12-3

    Number Portability and Messaging Architecture within SDP................................................ 12-4Communication Protocol Adapter........................................................................................... 12-4Order Processing Engine .......................................................................................................... 12-4Workflow Engine........................................................................................................................ 12-5Fulfillment Engine ...................................................................................................................... 12-5Event Manager ............................................................................................................................ 12-5SDP Repository ........................................................................................................................... 12-5

    The Number Portability Process.................................................................................................... 12-6What Happens Behind the Scenes When You Order a New Telephone Service .............. 12-6What Happens Behind the Scenes When You Change Local Service Providers............... 12-6XML is the Data Format. Advanced Queuing is Used at Each Point ................................. 12-7Why XML is Used for this Messaging ..................................................................................... 12-8

    Provisioning a Network Element .................................................................................................. 12-9Using Event Manager to Send and Receive Messages Asynchronously ............................... 12-9

    Example Code to Send Messages ........................................................................................... 12-10Using Internet Message Studio (iMessage) to Create an Application Message Set .......... 12-11

    Code Generation....................................................................................................................... 12-11Defining Message Sets ............................................................................................................. 12-11

    Part V Developing Oracle XML Applications: A - Z

    13 B2B XML Application: Step by Step

    Introduction to the B2B XML Application................................................................................... 13-3Requirements for Running the B2B XML Application ............................................................. 13-3Building the B2B XML Application: Overview .......................................................................... 13-3

    xvii

  • Why Transform Data to XML? ........................................................................................................ 13-5Why Use Advanced Queueing (AQ)? ........................................................................................... 13-6B2B XML Application: Main Components .................................................................................. 13-7Overview of Tasks to Run the B2B XML Application ............................................................... 13-8

    1 Set Up Your Environment to Run the B2B XML Application ......................................... 13-102 Run the B2B Application ...................................................................................................... 13-113 End the B2B Application Session......................................................................................... 13-11

    XML B2B Application: Setting Up the Database Schema....................................................... 13-12SQL Calling Sequence ................................................................................................................... 13-13Create and Build the Retailer and Supplier Schemas.............................................................. 13-14

    SQL Example 1: Set up the Retailer and Supplier Environment — BuildAll.sql ............ 13-14SQL Example 2: Create and Populate the Retailer-Supplier Schema — BuildSchema.sql .................................................................................................................... 13-15

    Create the AQ Environment and Queue Tables........................................................................ 13-20SQL Example 3: Set Up the Environment for AQ — mkAQUser.sql................................ 13-20SQL Example 4: Call the AQ Queue Creation Scripts — mkQ.sql .................................... 13-21SQL (PL/SQL) Example 5: Create Table, AppOne_QTab — mkQueueTableApp1.sql. 13-21SQL (PL/SQL) Example 6: Create Table, AppTwo_QTab — mkQueueTableApp2.sql 13-21SQL (PL/SQL) Example 7: Create Table, AppThree_QTab — mkQueueTableApp3.sql ...................................................................................................... 13-21SQL (PL/SQL) Example 8: Create Table, AppFour_QTab — mkQueueTableApp4.sql 13-22

    Create the Broker Schema Including XSL Stylesheet Table ................................................... 13-23SQL Example 9: Create Broker Schema — mkSSTables.sql ............................................... 13-23SQL (PL/SQL) Example 10: Input XSL data into CLOB. Populate the Broker Schema — setup.sql ................................................................................................. 13-25

    Cleaning Up Your Environment and Preparing to Rerun Application ................................ 13-26SQL Example 11: Stops and Drops Queue Applications. Starts Queue Applications — reset.sql ...................................................................................................... 13-27Stop Queue SQL Scripts........................................................................................................... 13-27Drop Queue SQL Scripts.......................................................................................................... 13-28Create Queue SQL Scripts ....................................................................................................... 13-28Start Queue SQL Scripts........................................................................................................... 13-29dropOrder.sql ............................................................................................................................ 13-29

    B2B XML Application: Data Exchange Flow ............................................................................. 13-31

    xviii

  • Retailer-Supplier Transactions..................................................................................................... 13-321 Retailer Browses the Supplier’s OnLine "Hi-Tech Mall" Catalog................................... 13-322 Retailer Places Order............................................................................................................. 13-323 Retailer Confirms and Commits to Sending the Order.................................................... 13-324 AQ Broker-Transformer Transforms the XML Document According to the Supplier’s Format ................................................................................................................. 13-335 Supplier Application Parses Incoming Reformatted XML Order Document. Inserts Order into the Supplier Database..................................................................................... 13-346 Supplier Application Alerts Supplier of Pending Order ................................................. 13-347 AQ Broker-Transformer Transforms the XML Order According to Retailer Format .................................................................................................................................. 13-348 Retailer Application Updates the Ord and Line_Item Tables......................................... 13-35

    Running the B2B XML Application: Detailed Procedure ....................................................... 13-361 Retailer Browses the Supplier’s OnLine "Hi-Tech Mall" Catalog..................................... 13-37

    XSQL Script Example 2: Checking the ID of Users Logging In: getlogged.xsql......... 13-41XSQL Script Example 1: Displays First Hi-Tech Mall Screen — index.xsql ................ 13-43XSQL Script Example 3: Lists Catalog Products — inventory.xsql ................................ 13-44XSQL Script Example 4: Enter a Quantity — order.xsql .................................................. 13-46

    2 Retailer Places Order.................................................................................................................. 13-493 "Validate" Commits the Transaction. Retailer Application Produces the XML Order.. 13-50

    XSQL Script Example 5: Starts B2B Process — placeorder.xsql...................................... 13-50Java Example 1: Action Handler Called by placeOrder.xsql — RetailActionHandler.java .................................................................................................... 13-51Java Example 2: Maintains Session Context for RetailActionHandler.java — SessionHolder.java ............................................................ 13-69

    4 AQ Broker-Transformer Transforms XML Document According to Supplier’s Format ........................................................................................................................................ 13-715 Supplier Application Parses the XML Document and Inserts the Order into the Supplier Database ...................................................................................................................... 13-756a Supplier Application Alerts Supplier of Pending Order .................................................. 13-76

    6b Supplier Decides to Ship the Product(s) to the Retailer ................................................ 13-786c Supplier Application Generates a New XML Message to Send to AQ Broker........... 13-79

    7 AQ Broker-Transformer Transforms XML Order into Retailer’s Format ........................ 13-808 Retailer Application Updates the Ord Table and Displays the New Order Status to Retailer .................................................................................................................................. 13-81

    xix

  • To Stop the B2B XML Application ......................................................................................... 13-81Check Your Order Status Directly Using vieworder.sql..................................................... 13-82

    Java Examples - Calling Sequence............................................................................................... 13-83XSL and XSL Management Scripts .............................................................................................. 13-85

    XSL Stylesheet Example 1: Converts Results to HTML — html.xsl .................................. 13-85XSL Stylesheet Example 2: Converts Results for Palm Pilot Browser — pp.xsl.............. 13-91Java Example 3: Stylesheet Management— GUIInterface.java.......................................... 13-97Java Example 4: GUIInterface_AboutBoxPanel.java ........................................................ 13-114Java Example 5: GUIStylesheet.java.................................................................................... 13-115

    XML Process and Management Scripts ................................................................................... 13-117Java Example 6: Main4XMLtoDMLv2.java........................................................................ 13-117Java Example 7: ParserTest.java .......................................................................................... 13-120Java Example 8: TableInDocument.java ............................................................................. 13-122Java Example 9: XMLFrame.java......................................................................................... 13-123Java Example 10: XMLProducer.java.................................................................................. 13-124Java Example 11: XMLtoDMLv2.java ................................................................................. 13-126Java Example 12: XMLGen.java........................................................................................... 13-134Java Example 13: XMLUtil.java ........................................................................................... 13-136Java Example 14: XSLTWrapper.java ................................................................................. 13-137

    Other Scripts Used in the B2B XML Application .................................................................. 13-142XML Example 1: XSQL Configuration — XSQLConfig.xml ........................................... 13-142Java Example 15: Message Header Script — MessageHeaders.java .............................. 13-149Java Example 16: Hold Constants for Use by Message Broker — AppCste.java ......... 13-150

    Retailer Scripts ............................................................................................................................. 13-150Java Example 17: Retailer Waits for Status Update Sent from Supplier — UpdateMaster.java............................................................................................................ 13-150

    AQ Broker-Transformer and Advanced Queuing Scripts.................................................... 13-157Java Example 18: AQ Broker Listens on One AQ Thread — BrokerThread.java......... 13-158Java Example 19: MessageBroker.java................................................................................ 13-163Java Example 20: AQReader.java ........................................................................................ 13-169Java Example 21: AQWriter.java ......................................................................................... 13-171Java Example 22: B2BMessage.java..................................................................................... 13-174Java Example 23: ReadStructAQ.java ................................................................................. 13-175Java Example 24: StopAllQueues.java ................................................................................ 13-176Java Example 25: WriteStructAQ.java ................................................................................ 13-177

    xx

  • Supplier Scripts............................................................................................................................. 13-180Java Example 26: SupplierFrame.java ................................................................................. 13-180Java Example 27: Agent Wakes Up with Order Received from Retailer — SupplierWatcher.java ..................................................................................... 13-186

    14 Using JDeveloper to Build Oracle XML Applications

    Introducing JDeveloper 3.2 ............................................................................................................. 14-2Business Components for Java (BC4J) ..................................................................................... 14-2Oracle JDeveloper XML Strategy ............................................................................................. 14-3

    What’s Needed to Run JDeveloper 3.2.......................................................................................... 14-3Accessing JDeveloper 3.2........................................................................................................... 14-3

    XML in Business Components for Java (BC4J) ........................................................................... 14-4Building XSQL Clients with Business Components for Java (BC4J) ..................................... 14-6

    Object Gallery.............................................................................................................................. 14-6XSQL Element Wizard............................................................................................................... 14-7Page Selector Wizard ................................................................................................................. 14-9

    XML Features in JDeveloper 3.2 .................................................................................................. 14-10Oracle XDK and Transviewer Beans Integration................................................................. 14-10Oracle XML Parser for Java..................................................................................................... 14-10Oracle XSQL Servlet ................................................................................................................. 14-11XML Data Generator Web Bean ............................................................................................. 14-12Mobile Application Development with Portal-To-Go and JDeveloper............................ 14-13

    Building XML Applications with JDeveloper .......................................................................... 14-14JDeveloper XML Example 1: BC4J Metadata........................................................................ 14-14Procedure for Building Applications in JDeveloper 3.2 ..................................................... 14-14

    Using JDeveloper’s XML Data Generator Web Bean .............................................................. 14-16Using XSQL Servlet from JDeveloper ........................................................................................ 14-19

    JDeveloper XSQL Example 2: Employee Data from Table emp: emp.xsql ...................... 14-19JDeveloper XSQL Example 3: Employee Data with Stylesheet Added............................ 14-20

    Creating a Mobile Application in JDeveloper .......................................................................... 14-221 Create the BC4J Application ............................................................................................... 14-232 Create JSP Pages Based on BC4J Application................................................................... 14-243 Create XSLT Stylesheets According to the Devices Needed to Read The Data .......... 14-25

    Frequently Asked Questions (FAQs): Using JDeveloper to Build XML Applications .... 14-29Constructing an XML Document in JSP................................................................................ 14-29

    xxi

  • Using XMLData From BC4J .................................................................................................... 14-30Running XML Parser for Java in JDeveloper 3.0.................................................................. 14-30Moving Complex XML Documents to a Database .............................................................. 14-33

    15 Using Internet File System (iFS) to Build XML Applications

    Introduction to Internet File System (iFS) ................................................................................... 15-2Working with XML in iFS ............................................................................................................... 15-2

    Supply a Document Descriptor ................................................................................................ 15-2Using the iFS Parsers........................................................................................................................ 15-3

    Standard iFS Parsers and Custom Parsers .............................................................................. 15-3Using iFS Standard Parsers ............................................................................................................. 15-4

    Parsing Options........................................................................................................................... 15-4Using iFS Custom Parsers ............................................................................................................... 15-5How iFS XML Parsing Works ......................................................................................................... 15-5Writing a Parser Application .......................................................................................................... 15-6Rendering XML in iFS ..................................................................................................................... 15-7XML and Business Intelligence...................................................................................................... 15-7Configuring iFS with XML Files .................................................................................................... 15-7

    16 Building n-Tier Architectures for Media-Rich Management using XML:ArtesiaTech

    Introduction to Building n-Tier Architectures ............................................................................ 16-2XML-Based, Multi-Tier Communication...................................................................................... 16-2Function Shipping: Separating Logical and Physical Tiers...................................................... 16-3Object-Oriented Messaging with XML ........................................................................................ 16-4

    Should XML be Used for Messaging?...................................................................................... 16-6Using XML or IDL? .................................................................................................................... 16-6

    Message Processing with XML....................................................................................................... 16-8Scripting With XML.......................................................................................................................... 16-9Inter-Tier Communication ............................................................................................................ 16-12Transaction State Management for Web-Based Services ........................................................ 16-14XML-Based Software Quality Assurance ................................................................................... 16-14XML-Based Data Dissemination.................................................................................................. 16-15

    xxii

  • XML-Centric Digital Asset Management................................................................................... 16-16Digital Asset Aggregation Facilitating End-User Personalization.................................... 16-16Digital Asset Aggregation Addressing Bandwidth Implications...................................... 16-17

    Summary........................................................................................................................................... 16-18

    Part VI XDK for Java

    17 Using XML Parser for Java

    XML Parser for Java: Features ........................................................................................................ 17-2XSL Transformation (XSL-T) Processor.................................................................................. 17-3Namespace Support ................................................................................................................... 17-4Validating and Non-Validating Mode Support ..................................................................... 17-4

    Parsers Access XML Document’s Content and Structure.......................................................... 17-5DOM and SAX APIs......................................................................................................................... 17-6

    DOM: Tree-Based API................................................................................................................ 17-6SAX: Event -Based API .............................................................................................................. 17-6Guidelines for Using DOM and SAX APIs ............................................................................. 17-7

    Running the XML Parser for Java Samples ................................................................................. 17-8XML Parser for Java - XML Sample 1: class.xml.................................................................... 17-9XML Parser for Java - XML Example 2: Using DTD employee — employee.xml ............ 17-9XML Parser for Java - XML Example 3: Using DTD family.dtd — family.xml............... 17-10XML Parser for Java - XSL Example 1: XSL (iden.xsl)........................................................ 17-10XML Parser for Java - DTD Example 1: (NSExample) ........................................................ 17-10

    Using XML Parser for Java: DOMParser() Class ...................................................................... 17-12XML Parser for Java Example 1: Using the Parser and DOM API (DomSample.java) .. 17-14Comments on DOMParser() Example 1................................................................................ 17-18

    Using XML Parser for Java: DOMNamespace() Class ............................................................. 17-20XML Parser for Java Example 2: Parsing a URL — DOMNamespace.java ..................... 17-20

    Using XML Parser for Java: SAXParser() Class ......................................................................... 17-25XML Parser for Java Example 3: Using the Parser and SAX API (SAXSample.java) ..... 17-25

    Using XML Parser for Java: XSL-T Processor ............................................................................ 17-30XML Parser for Java Example 4: (XSLSample.java)............................................................. 17-31XML Parser for Java Example 5: Using the DOMAPI and XSL-T Processor ................... 17-34Comments on XSL-T Example 5............................................................................................. 17-36

    xxiii

  • Using XML Parser for Java: SAXNamespace() Class................................................................ 17-38XML Parser for Java Example 6: (SAXNamespace.java)..................................................... 17-38

    XML Parser for Java: Command Line Interfaces....................................................................... 17-42oraxml - Oracle XML parser.................................................................................................... 17-42oraxsl - Oracle XSL processor ................................................................................................. 17-42

    XML Extension Functions for XSL-T Processing ...................................................................... 17-45XSL-T Processor Extension Functions: Introduction ........................................................... 17-45Static Versus Non-static Methods .......................................................................................... 17-45Constructor Extension Function ............................................................................................. 17-46Return Value Extension Function........................................................................................... 17-46XML Parser for Java XSL Example 3: Return Value Extension Function ......................... 17-46Datatypes Extension Function ................................................................................................ 17-47XML Parser for Java Example 4: Datatype Extension Function......................................... 17-47

    Frequently Asked Questions (FAQs): XML Parser for Java................................................... 17-48DTDs ................................................................................................................................................. 17-48

    Checking DTD Syntax: Suggestions for Editors................................................................... 17-48DTD File in DOCTYPE Must be Relative to XML Document Location............................ 17-50Validating an XML File Using External DTD....................................................................... 17-50DTD Caching ............................................................................................................................. 17-50Recognizing External DTDs .................................................................................................... 17-51Loading external DTD’s from a jar File ................................................................................. 17-52Can I Check the Correctness of an XML Document Using their DTD?............................ 17-52Parsing a DTD Object Separately from XML Document .................................................... 17-53Case-Sensitivity in Parser Validation against DTD? ........................................................... 17-53Extracting Embedded XML From a CDATA Section .......................................................... 17-54

    DOM and SAX APIs ....................................................................................................................... 17-56Using the DOM API ................................................................................................................. 17-56How DOM Parser Works......................................................................................................... 17-56Creating a Node With Value to be Set Later......................................................................... 17-56Traversing the XML Tree......................................................................................................... 17-57Extracting Elements from XML File....................................................................................... 17-57Does a DTD Validate the DOM Tree?.................................................................................... 17-57First Child Node Element Value............................................................................................. 17-57Creating DocType Node .......................................................................................................... 17-58XMLNode.selectNodes() Method........................................................................................... 17-58

    xxiv

  • Using SAX API to Get the Data Value................................................................................... 17-59SAXSample.java........................................................................................................................ 17-60Does DOMParser implement Parser interface ..................................................................... 17-60Creating an New Document Type Node Via DOM ............................................................ 17-60Querying for First Child Node’s Value of a Certain Tag.................................................... 17-61XML Document Generation From Data in Variables.......................................................... 17-61Printing Data in the Element Tags: DOM API ..................................................................... 17-62Building XML Files from Hashtable Value Pairs................................................................. 17-63XML Parser for Java: wrong_document_err on Node.appendChild() ............................. 17-63Creating Nodes: DOMException when Setting Node Value ............................................. 17-65

    Validation ......................................................................................................................................... 17-66DTD: Understanding DOCTYPE and Validating Parser.................................................... 17-66Can Multiple Threads Use Single XSLProcessor/Stylesheet? ........................................... 17-66Is it Safe to Use Document Clones in Multiple Threads? ................................................... 17-67

    Character Sets .................................................................................................................................. 17-68Encoding iso-