Purexml Guide

Purexml Guide

IBM DB2 10.1 for Linux, UNIX, and Windows pureXML Guide SC27-3892-00 IBM DB2 10.1 for Linux, UNIX, and Windows pureXML Guide SC27-3892-00 Note Before using this information and the product it supports, read the general information under Appendix E, “Notices,” on page 501. Edition Notice This document contains proprietary information of IBM. It is provided under a license agreement and is protected by copyright law. The information contained in this publication does not include any product warranties, and any statements provided in this manual should not be interpreted as such. You can order IBM publications online or through your local IBM representative. v To order publications online, go to the IBM Publications Center at http://www.ibm.com/shop/publications/ order v To find your local IBM representative, go to the IBM Directory of Worldwide Contacts at http://www.ibm.com/ planetwide/ To order DB2 publications from DB2 Marketing and Sales in the United States or Canada, call 1-800-IBM-4YOU (426-4968). When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright IBM Corporation 2006, 2012. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents About this book ...........vii Displaying detailed XML parsing and validation errors...............55 Chapter 1. pureXML overview -- DB2 as ErrorLog XML schema definition for enhanced an XML database ...........1 error message support ..........57 Using XML in a non-Unicode database .....60 XML data type .............3 XML input and output overview .......3 Chapter 5. Querying XML data ....65 Comparison of the XML model and the relational model ................8 Introduction to XQuery ..........65 XQuery and XPath data model ........10 Retrieving DB2 data with XQuery functions . 66 Sequences and items ..........10 Introduction to querying XML data with SQL . 67 Atomic values ............11 Comparison of XQuery to SQL ........68 Node hierarchies ...........11 Comparison of methods for querying XML data . 69 Node properties ............12 Specifying XML namespaces.........70 Node kinds .............13 Example: Changing the namespace prefix of an Document order of nodes.........15 element................72 Node identity ............16 XMLQUERY function overview........73 Typed values and string values of nodes . 16 Non-empty sequences returned by XMLQUERY 74 Tools that support XML ..........16 Empty sequences returned by XMLQUERY . 75 Federation support for pureXML .......18 Casting of XMLQUERY results to non-XML types 76 Replication and event publishing support for Casting between data types ........77 pureXML ...............18 XMLQUERY .............85 Articles on XML support ..........19 XMLTABLE function overview ........87 Example: Inserting values returned from Chapter 2. pureXML tutorial......21 XMLTABLE .............89 Example: Returning one row for each occurrence Lesson 1: Creating a DB2 database and table that of an item using XMLTABLE .......90 can store XML data............22 Example: Processing elements from multiple trees Lesson 2: Creating indexes over XML data ....22 in an XML document using XMLTABLE ....92 Lesson 3: Inserting XML documents into XML type Example: Processing hierarchical data using columns ...............23 XMLTABLE .............93 Lesson 4: Updating XML documents stored in XML XMLTABLE .............95 columns ...............24 XMLEXISTS predicate when querying XML data . 99 Lesson 5: Deleting XML data ........25 XMLEXISTS predicate usage .......100 Lesson 6: Querying XML data ........27 XMLEXISTS predicate .........101 Lesson 7: Validating XML documents against XML Passing parameters between SQL statements and schemas ...............30 XQuery expressions ...........104 Lesson 8: Transforming with XSLT stylesheets . 31 Constant and parameter marker passing to XMLEXISTS and XMLQUERY .......104 Chapter 3. XML storage .......35 Simple column name passing with XMLEXISTS, XML storage object ............35 XMLQUERY, or XMLTABLE .......105 XML base table row storage .........36 Passing parameters from XQuery to SQL . 106 Storage requirements for XML documents ....37 Data retrieval with XQuery.........107 Data types for archiving XML documents ....38 Guidelines for matching indexes with queries overview ...............109 Chapter 4. Inserting XML data .....39 Restrictiveness of index definitions .....110 Creation of tables with XML columns......39 Considerations when specifying text() nodes . 112 Addition of XML columns to existing tables . 40 Data type of literals ..........113 Insertion into XML columns .........40 Join predicate conversion ........114 XML parsing ..............41 Indeterminate query evaluation ......115 XML data integrity ............46 Full-text search in XML documents ......116 Check constraints on XML columns .....46 Retrieval of data in XML columns to earlier DB2 Trigger processing of XML data.......48 clients ................117 XML validation ............50 SQL/XML publishing functions for constructing XSR_GET_PARSING_DIAGNOSTICS stored XML values ..............118 procedure ..............53 Examples of publishing XML values .....119 © Copyright IBM Corp. 2006, 2012 iii Special character handling in SQL/XML Registering XSR objects through the command publishing functions ..........123 line processor ............203 XML serialization ...........124 Java support for XML schema registration and Transforming with XSLT stylesheets ......125 removal ..............204 Passing parameters to XSLT stylesheets at Altering registered XSR objects .......206 runtime ..............128 Evolving an XML schema ........206 Example: Using XSLT as a formatting engine 128 Compatibility requirements for evolving an Example: Using XSLT for data exchange . 130 XML schema ............207 Example: Using XSLT to remove namespaces 131 Scenario: Evolving an XML schema .....214 Example: Using the document function of XSLT 134 Examples of extracting XML schema information 216 Important considerations for transforming XML Listing XML schemas registered with the XSR 216 documents .............136 Retrieving all components of an XML schema Differences in an XML document after storage and registered with the XSR .........216 retrieval ...............136 Retrieving the XML schema of an XML document .............217 Chapter 6. Indexing XML data ....139 Index XML pattern expressions .......140 Chapter 9. XML data movement . 219 Examples of using case insensitive XML indexes 143 Important considerations for XML data movement 220 Examples of using indexes that specify fn:exists 145 Query and XPath Data Model ........221 Examples of using indexes with queries that LOB and XML file behavior when importing and specify fn:starts-with ..........148 exporting...............221 Context steps and function expression steps . 150 XML data specifier ...........222 XML namespace declarations ........150 Exporting XML data ...........223 Data types associated with index XML pattern Importing XML data ...........226 expressions ..............152 Loading XML data ...........227 Data type conversion for indexes over XML data 153 Resolving indexing errors when loading XML Invalid XML values ..........154 data ...............228 Document rejection or CREATE INDEX statement failure ...........156 Chapter 10. Application programming Summary table for conversion to the index XML language support .........235 data type ..............157 CLI.................236 XML schemas and index key generation ....158 XML data handling in CLI applications - UNIQUE keyword semantics ........159 Overview..............236 Database objects associated with XML data XML column inserts and updates in CLI indexing ...............160 applications .............237 Logical and physical indexes over XML data 160 XML data retrieval in CLI applications ....238 Other database objects associated with XML Changing of default XML type handling in CLI columns ..............161 applications .............239 Recreation of indexes over XML data ....162 Embedded SQL ............239 CREATE INDEX ............163 Declaring XML host variables in embedded SQL Sample queries against indexes over XML data . 183 applications .............239 Restrictions on indexes over XML data .....186 Example: Referencing XML host variables in Common XML indexing issues .......188 embedded SQL applications .......240 Troubleshooting SQL20305N messages issued by Executing XQuery expressions in embedded INSERT or UPDATE statements ......188 SQL applications ...........242 Troubleshooting SQL20306N messages issued by Recommendations for developing embedded CREATE INDEX statements on populated tables 191 SQL applications with XML and XQuery . 243 Identifying XML values in an SQLDA ....244 Chapter 7. Updating XML data ....193 Java ................244 Use of updating expressions in a transform Binary XML format in Java applications . 244 expression ..............194 JDBC ...............246 Updating XML documents with information from SQLJ ...............254 other tables ..............197 PHP................258 Deletion of XML data from tables ......198 PHP application development for IBM data servers ..............258 Chapter 8. XML schema repository 201 XML data retrieval using PHP applications . 259 XSR objects ..............201 PHP downloads and related resources ....260 XSR object registration ..........201 Perl ................260 Registering

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    527 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us