9i rel 2 xml db dev gd

908 1.9K 0
9i rel 2 xml db dev gd

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Oracle9 i XML Database Developer’s Guide - Oracle XML DB Release 2 (9.2) March 2002 Part No. A96620-01 Oracle9i XML Database Developer’s Guide - Oracle XML DB, Release 2 (9.2) Part No. A96620-01 Copyright © 2002 Oracle Corporation. All rights reserved. Primary Author: Shelley Higgins Graphics: Valarie Moore Contributing Authors: Nipun Agarwal, Abhay Agrawal, Omar Alonso, Sandeepan Banerjee, Mark Bauer, Ravinder Booreddy, Yuen Chan, Sivasankaran Chandrasekar, Vincent Chao, Mark Drake, Fei Ge, Wenyun He, Sam Idicula, Neema Jalali, Bhushan Khaladkar, Viswanathan Krishnamurthy, Muralidhar Krishnaprasad, Wesley Lin, Annie Liu, Anand Manikutty, Jack Melnick, Nicolas Montoya, Steve Muench, Ravi Murthy, Eric Paapanen, Syam Pannala, John Russell, Eric Sedlar, Vipul Shah, Cathy Shea, Tarvinder Singh, Simon Slack, Muralidhar Subramanian, Priya Vennapusa, James Warner Contributors: Harish Akali, Deanna Bradshaw, Paul Brandenstein, Lisa Eldridge, Susan Kotsovolos, Sonia Kumar, Roza Leyderman, Diana Lorentz, Yasuhiro Matsuda, Bhagat Nainani, Visar Nimani, Sunitha Patel, Denis Raphaely, Rebecca Reitmeyer, Ronen Wolf The Programs (which include both the software and documentation) contain proprietary information of Oracle Corporation; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent and other intellectual and industrial property laws. Reverse engineering, disassembly or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this document is error-free. Except as may be expressly permitted in your license agreement for these Programs, 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 on behalf of the U.S. Government, the following notice is applicable: Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial computer 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 computer software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR 52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City, CA 94065. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous 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 for such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the Programs. Oracle is a registered trademark, and Oracle9i, Oracle8i, Oracle8, SQL*Plus, On Oracle, Oracle Store, Oracle Press, ConText, and PL/SQL are trademarks or registered trademarks of Oracle Corporation. Other names may be trademarks of their respective owners. iii Contents Send Us Your Comments xxvii Preface xxix Audience xxx Organization xxx Related Documentation xxxv Conventions xxxvi Documentation Accessibility xxxix What’s New In Oracle XML DB? xli Oracle XML DB: XMLType Enhancements xli Oracle XML DB: Repository xliii Oracle Tools Enhancements for Oracle XML DB xlv Oracle Text Enhancements xlv Oracle Advanced Queuing (AQ) Support xlv Oracle XDK Support for XMLType xlvi Part I Introducing Oracle XML DB 1 Introducing Oracle XML DB Introducing Oracle XML DB 1-2 Not a Separate Database Server 1-2 Benefits of Oracle XML DB 1-3 Key Features of Oracle XML DB 1-4 iv Oracle XML DB and XML Schema 1-7 Oracle XML DB Architecture 1-8 XMLType Tables and Views Storage 1-10 Oracle XML DB Repository 1-11 XMLType Storage Architecture 1-12 Cached XML Object Management Architecture 1-15 XML Repository Architecture 1-16 Why Use Oracle XML DB? 1-17 Unifying Data and Content with Oracle XML DB 1-18 Oracle XML DB Offers Faster Storage and Retrieval of Complex XML Documents 1-21 Oracle XML DB Helps You Integrate Applications 1-22 When Your Data Is Not XML You Can Use XMLType Views 1-22 Searching XML Data Stored in CLOBs Using Oracle Text 1-24 Building Oracle XML DB XML Messaging Applications with Advanced Queueing 1-24 Managing Oracle XML DB Applications with Oracle Enterprise Manager 1-25 Requirements for Running Oracle XML DB 1-26 Standards Supported by Oracle XML DB 1-26 Oracle XML DB Technical Support 1-27 Terminology Used in This Manual 1-27 Oracle XML DB Examples Used in This Manual 1-30 2 Getting Started with Oracle XML DB Getting Started with Oracle XML DB 2-2 Installing Oracle XML DB 2-2 When to Use the Oracle XML DB 2-2 Designing Your XML Application 2-3 Oracle XML DB Design Issues: Introduction 2-3 a. Data 2-3 b. Access 2-3 c. Application Language 2-4 d. Processing 2-4 Storage 2-4 Oracle XML DB Application Design: a. How Structured Is Your Data? 2-5 Oracle XML DB Application Design: b. Access Models 2-7 Oracle XML DB Application Design: c. Application Language 2-8 v Oracle XML DB Application Design: d. Processing Models 2-9 Oracle XML DB Design: Storage Models 2-10 Using XMLType Tables 2-11 Using XMLType Views 2-12 3 Using Oracle XML DB Storing Data in an XMLType Column or XMLType Table 3-3 Accessing Data in XMLType Columns or XMLType Tables 3-4 Using XPath with Oracle XML DB 3-5 Using existsNode() 3-6 Using extractValue() 3-8 Using extract() 3-10 Using XMLSequence() 3-11 Updating XML Documents with updateXML() 3-12 Introducing the W3C XSLT Recommendation 3-14 Using XSL/XSLT with Oracle XML DB 3-16 Other XMLType Methods 3-17 Introducing the W3C XML Schema Recommendation 3-17 Using XML Schema with Oracle XML DB 3-19 XMLSchema-Instance Namespace 3-21 Validating an XML Document Using an XML Schema 3-22 Storing XML: Structured or Unstructured Storage 3-24 Data Manipulation Language (DML) Independence 3-27 DOM Fidelity in Structured and Unstructured Storage 3-27 Structured Storage: XML Schema-Based Storage of XMLType 3-28 Structured Storage: Storing complexType Collections 3-32 Structured Storage: Data Integrity and Constraint Checking 3-33 Oracle XML DB Repository 3-34 Query-Based Access to Oracle XML DB Repository 3-36 Using RESOURCE_VIEW 3-37 Using PATH_VIEW 3-37 Creating New Folders and Documents 3-37 Querying Resource Documents 3-38 Updating Resources 3-38 Deleting Resources 3-39 vi Storage Options for Resources 3-40 Defining Your Own Default Table Storage for XML Schema-Based Documents 3-40 Accessing XML Schema-Based Content 3-43 Accessing Non-Schema-Based Content With XDBUriType 3-44 Oracle XML DB Protocol Servers 3-44 Using FTP Protocol Server 3-44 Using HTTP/WebDAV Protocol Server 3-49 Part II Storing and Retrieving XML Data in Oracle XML DB 4 Using XMLType What Is XMLType? 4-2 Benefits of the XMLType Data Type and API 4-3 When to Use XMLType 4-4 Storing XMLType Data in Oracle XML DB 4-4 Pros and Cons of XML Storage Options in Oracle XML DB 4-5 When to Use CLOB Storage for XMLType 4-6 XMLType Member Functions 4-7 How to Use the XMLType API 4-7 Creating, Adding, and Dropping XMLType Columns 4-8 Inserting Values into an XMLType Column 4-9 Using XMLType in an SQL Statement 4-9 Updating an XMLType Column 4-9 Deleting a Row Containing an XMLType Column 4-10 Guidelines for Using XMLType Tables and Columns 4-11 Specifying Storage Characteristics on XMLType Columns 4-12 Changing Storage Options on an XMLType Column Using XMLData 4-13 Specifying Constraints on XMLType Columns 4-14 Manipulating XML Data in XMLType Columns/Tables 4-14 Inserting XML Data into XMLType Columns/Tables 4-15 Using INSERT Statements 4-15 Selecting and Querying XML Data 4-17 Selecting XML Data 4-17 Querying XML Data 4-18 Using XPath Expressions for Searching XML Documents 4-18 vii Querying XML Data Using XMLType Member Functions 4-19 existsNode Function 4-20 extract () Function 4-21 extractValue() Function 4-23 More SQL Examples That Query XML 4-26 Updating XML Instances and Data in Tables and Columns 4-31 updateXML() SQL Function 4-31 Creating Views of XML Data with updateXML() 4-35 updateXML() and NULL Values 4-35 Updating the Same XML Node More Than Once 4-36 XMLTransform() Function 4-36 Deleting XML Data 4-37 Using XMLType In Triggers 4-37 Indexing XMLType Columns 4-38 Creating Function-Based Indexes on XMLType Columns 4-38 Creating Oracle Text Indexes on XMLType Columns 4-39 5 Structured Mapping of XMLType Introducing XML Schema 5-3 XML Schema and Oracle XML DB 5-3 Using Oracle XML DB and XML Schema 5-5 Why Do We Need XML Schema? 5-6 Introducing DBMS_XMLSCHEMA 5-7 Registering Your XML Schema Before Using Oracle XML DB 5-8 Registering Your XML Schema Using DBMS_XMLSCHEMA 5-8 Local and Global XML Schemas 5-10 Registering Your XML Schema: Oracle XML DB Sets Up the Storage and Access Infrastructure 5-12 Deleting Your XML Schema Using DBMS_XMLSCHEMA 5-13 Guidelines for Using Registered XML Schemas 5-14 Objects That Depend on Registered XML Schemas 5-14 Creating XMLType Tables, Views, or Columns 5-14 Validating XML Instances Against the XML Schema: schemaValidate() 5-15 Fully Qualified XML Schema URLs 5-16 Transactional Behavior of XML Schema Registration 5-17 viii Java Bean Generation During XML Schema Registration 5-17 Generating XML Schema Using DBMS_XMLSCHEMA.generateSchema() 5-18 XML Schema-Related Methods of XMLType 5-20 Managing and Storing XML Schema 5-20 Root XML Schema, XDBSchema.xsd 5-20 How Are XML Schema-Based XMLType Structures Stored? 5-21 DOM Fidelity 5-21 How Oracle XML DB Ensures DOM Fidelity with XML Schema 5-22 DOM Fidelity and SYS_XDBPD$ 5-22 Creating XMLType Tables and Columns Based on XML Schema 5-23 SQL Object-Relational Types Store XML Schema-Based XMLType Tables 5-24 Specifying SQL Object Type Names with SQLName, SQLType Attributes 5-25 SQL Mapping Is Specified in the XML Schema During Registration 5-29 Mapping of Types Using DBMS_XMLSCHEMA 5-32 Setting Attribute Mapping Type Information 5-32 Setting Element Mapping Type Information 5-32 XML Schema: Mapping SimpleTypes to SQL 5-34 simpleType: Mapping XML Strings to SQL VARCHAR2 Versus CLOBs 5-37 XML Schema: Mapping complexTypes to SQL 5-38 Setting the SQLInLine Attribute to FALSE for Out-of-Line Storage 5-38 Mapping XML Fragments to Large Objects (LOBs) 5-40 Oracle XML DB complexType Extensions and Restrictions 5-42 complexType Declarations in XML Schema: Handling Inheritance 5-42 Mapping complexType: simpleContent to Object Types 5-45 Mapping complexType: Any and AnyAttributes 5-46 Handling Cycling Between complexTypes in XML Schema 5-47 Further Guidelines for Creating XML Schema-Based XML Tables 5-50 Specifying Storage Clauses in XMLType CREATE TABLE Statements 5-51 Inserting New Instances into XMLType Columns 5-52 Query Rewrite with XML Schema-Based Structured Storage 5-52 What Is Query Rewrite? 5-52 When Does Query Rewrite Occur? 5-53 What XPath Expressions Are Rewritten? 5-54 How are the XPaths Rewritten? 5-56 Rewriting XPath Expressions: Mapping Types and Issues 5-58 ix XPath Expression Rewrites for existsNode() 5-63 Rewrite for extractValue() 5-66 Rewrite for extract() 5-68 Optimizing Updates Using updateXML() 5-70 Creating Default Tables During XML Schema Registration 5-71 Ordered Collections in Tables (OCTs) 5-72 Using OCT for VARRAY Storage 5-72 Cyclical References Between XML Schemas 5-72 6 Transforming and Validating XMLType Data Transforming XMLType Instances 6-2 XMLTransform() and XMLType.transform() 6-2 XMLTransform() Examples 6-3 Validating XMLType Instances 6-8 Validating XML Data Stored as XMLType: Examples 6-10 7 Searching XML Data with Oracle Text Searching XML Data with Oracle Text 7-3 Introducing Oracle Text 7-3 Assumptions Made in This Chapter’s Examples 7-4 Oracle Text Users and Roles 7-5 Querying with the CONTAINS Operator 7-6 Using the WITHIN Operator to Narrow Query Down to Document Sections 7-7 Introducing SECTION_GROUPS 7-8 XML_SECTION_GROUP 7-8 AUTO_ SECTION_GROUP/ PATH_SECTION_GROUP for INPATH and HASPATH 7-10 Dynamically Adding Sections or Stop Section Using ALTER INDEX 7-10 WITHIN Syntax for Section Querying 7-11 WITHIN Operator Limitations 7-11 INPATH or HASPATH Operators Search Using XPath-Like Expressions 7-12 Using INPATH Operator for Path Searching in XML Documents 7-12 Using HASPATH Operator for Path Searching in XML Documents 7-19 Building a Query Application with Oracle Text 7-21 What Role Do You Need? 7-21 x Step 1. Create a Section Group Preference 7-21 Deciding Which Section Group to Use 7-23 Creating a Section Preference with XML_SECTION_GROUP 7-23 Creating a Section Preference with AUTO_SECTION_GROUP 7-23 Creating a Section Preference with PATH_SECTION_GROUP 7-24 Step 2. Set the Preference’s Attributes 7-24 2.1 XML_SECTION_GROUP: Using CTX_DDL.add_zone_section 7-25 2.2 XML_SECTION_GROUP: Using CTX_DDL.Add_Attr_Section 7-25 2.3 XML_SECTION_GROUP: Using CTX_DDL.Add_Field_Section 7-26 2.5 AUTO_SECTION_GROUP: Using CtX_DDL.Add_Stop_Section 7-28 Step 3. Create an Index Using the Section Preference Created in Step 2 7-28 Step 4. Create Your Query Syntax 7-30 Querying Within Attribute Sections 7-30 Presenting the Results of Your Query 7-34 XMLType Indexing 7-34 You Need Query Rewrite Privileges 7-35 System Parameter is Set to the Default, CTXSYS.PATH_SECTION_GROUP 7-36 XMLType Indexes Work Like Other Oracle Text Indexes 7-36 Using Oracle Text with Oracle XML DB 7-37 Creating an Oracle Text Index on a UriType Column 7-37 Querying XML Data: Use CONTAINS or existsNode()? 7-38 Full-Text Search Functions in XPath Using ora:contains 7-40 ora:contains Features 7-40 ora:contains Syntax 7-40 ora:contains Examples 7-41 Oracle XML DB: Creating a Policy for ora:contains() 7-42 Oracle XML DB: Using CTXXPATH Indexes for existsNode() 7-45 Why do We Need CTXXPATH When ConText Indexes Can Perform XPath Searches? 7-45 CTXXPATH Index Type 7-46 Creating CTXXPATH Indexes 7-46 Creating CTXXPATH Storage Preferences with CTX_DDL. Statements 7-47 Performance Tuning CTXXPATH Index: Synchronizing and Optimizing the Index 7-47 Using Oracle Text: Advanced Techniques 7-49 Distinguishing Tags Across DocTypes 7-49 Specifying Doctype Limiters to Distinguish Between Tags 7-50 [...]... 13 12- 14 12- 14 12- 15 12- 16 12- 16 12- 17 12- 17 12- 17 12- 18 12- 20 12- 21 12- 22 12- 22 12- 23 12- 25 12- 25 12- 26 12- 28 12- 29 12- 30 12- 31 12- 34 12- 34 12- 36 12- 37 12- 38 Oracle XML DB Repository: Foldering, Security, and Protocols Oracle XML DB Foldering Introducing Oracle XML DB Foldering Oracle XML DB Repository Repository Terminology Oracle XML DB Resources Where... Part VI 21 19-8 19-8 19-10 19-10 19-11 20 -2 20 -2 20-3 20 -3 20 -3 20 -3 20 -4 20 -4 20 -8 20 -9 20 -9 20 -10 20 -10 20 -11 20 - 12 20- 12 Oracle Tools that Support Oracle XML DB Managing Oracle XML DB Using Oracle Enterprise Manager Introducing Oracle XML DB and Oracle Enterprise Manager Getting Started with Oracle Enterprise Manager and Oracle XML DB Oracle Enterprise Manager Oracle XML DB Features... Expressions 21 - 42 22 Loading XML Data into Oracle XML DB Loading XMLType Data into Oracle9i Database 22 -2 Restoration 22 -2 Using SQL*Loader to Load XMLType Columns 22 -2 Part VII 23 XML Data Exchange Using Advanced Queueing Exchanging XML Data Using Advanced Queueing (AQ) What Is AQ? How Do AQ and XML Complement Each Other? XMLType Attributes... Parser API for XMLType (DBMS_XSLPROCESSOR): Calling Sequence PL/SQL XSLT Processor for XMLType Example xii 8 -2 8 -2 8-3 8-4 8-5 8-5 8-7 8-8 8-9 8-10 8-11 8- 12 8-18 8-18 8 -20 8 -21 8 -21 8 -22 8 -24 8 -24 8 -26 8 -27 8 -28 8 -28 8 -28 8 -29 8-30 8-31 9 Java and Java Bean APIs for XMLType Introducing Java DOM and Java Bean APIs for XMLType Java DOM API for XMLType Accessing XML Documents... Oracle XML DB Installing Oracle XML DB A -2 Installing or Reinstalling Oracle XML DB from Scratch A -2 Installing a New Oracle XML DB with DBCA A -2 Installing a New Oracle XML DB Manually Without DBCA A-3 Reinstalling Oracle XML DB A-4 Upgrading an Existing Oracle XML DB Installation A-4 Configuring Oracle XML DB A-4 Oracle XML DB Configuration... with Multiple Oracle XML DB Resources Simultaneously 16 Oracle XML DB Resource API for PL/SQL (DBMS_XDB) Introducing Oracle XML DB Resource API for PL/SQL Overview of DBMS_XDB DBMS_XDB: Oracle XML DB Resource Management Using DBMS_XDB to Manage Resources, Calling Sequence DBMS_XDB: Oracle XML DB ACL-Based Security Management Using DBMS_XDB to Manage Security,... Oracle XML DB Create and Manage Resources Manage XML Schema and Related Database Objects 21 -2 21 -2 21-3 21 -4 21 -4 21 -4 xix The Enterprise Manager Console for Oracle XML DB 21 -7 XML Database Management Window: Right-Hand Dialog Windows 21 -7 Hierarchical Navigation Tree: Navigator 21 -7 Configuring Oracle XML DB with Enterprise Manager 21 -7 Viewing... Oracle XML DB XMLType API, PL/SQL and Resource PL/SQL APIs: Quick Reference XMLType API F -2 PL/SQL DOM API for XMLType (DBMS_XMLDOM) F-6 PL/SQL Parser for XMLType (DBMS_XMLPARSER) F-13 PL/SQL XSLT Processor for XMLType (DBMS_XSLPROCESSOR) F-14 DBMS_XMLSCHEMA F-15 Oracle XML DB XML Schema Catalog Views F-18 Resource API for PL/SQL (DBMS_XDB)... XML DB Configuration Parameters 21 -11 Creating and Managing Oracle XML DB Resources with Enterprise Manager 21 - 12 Administering Individual Resources 21 -15 Individual Resource Content Menu 21 -17 Enterprise Manager and Oracle XML DB: ACL Security 21 -22 Granting and Revoking User Privileges with User > XML Tab 21 -23 XML Database Resource Privileges 21 -25 ... XDBResource.xsd xxiv G -2 G -2 G-3 G-8 G-9 G-10 G-11 G- 12 G- 12 G- 12 G- 12 G- 12 acl.xsd: XML Schema for Representing Oracle XML DBACLs ACL Representation XML Schema, acl.xsd acl.xsd xdbconfig.xsd: XML Schema for Configuring Oracle XML DB xdbconfig.xsd G-15 G-15 G-15 G-18 G-18 Glossary Index xxv xxvi Send Us Your Comments Oracle9i XML . Expressions 21 - 42 22 Loading XML Data into Oracle XML DB Loading XMLType Data into Oracle9i Database 22 -2 Restoration 22 -2 Using SQL*Loader to Load XMLType Columns 22 -2 Part VII XML Data Exchange. 1-30 2 Getting Started with Oracle XML DB Getting Started with Oracle XML DB 2- 2 Installing Oracle XML DB 2- 2 When to Use the Oracle XML DB 2- 2 Designing Your XML Application 2- 3 Oracle XML DB. Oracle9 i XML Database Developer’s Guide - Oracle XML DB Release 2 (9 .2) March 20 02 Part No. A96 620 -01 Oracle9i XML Database Developer’s Guide - Oracle XML DB, Release 2 (9 .2) Part No. A96 620 -01 Copyright

Ngày đăng: 18/04/2014, 10:23

Mục lục

  • Contents

  • Send Us Your Comments

  • Preface

    • Audience

      • Prerequisite Knowledge

      • Organization

        • PART I. Introducing Oracle XML DB

        • PART II. Storing and Retrieving XML Data

        • PART III. Using XMLType APIs to Manipulate XML Data

        • PART IV. Viewing Existing Data as XML

        • PART V. Oracle XML DB Repository: Foldering, Security, and Protocols

        • PART VI. Oracle Tools That Support Oracle XML DB Development

        • PART VII. XML Data Exchange Using Advanced Queueing

        • Related Documentation

        • Conventions

          • Conventions in Text

          • Conventions in Code Examples

          • Documentation Accessibility

          • What’s New In Oracle XML DB?

            • Oracle XML DB: XMLType Enhancements

              • XMLType Tables

              • XMLType Constructors

              • W3C XML Schema Support

              • SQLX Functions and Oracle Extensions

              • W3C XPath Support for Extraction, Condition Checks, and Updates

              • ToObject Method

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan