XML Extender - Can't an element be a key to a table while shredding XML

XML Extender - Can't an element be a key to a table while shredding XML

Post by Flor » Tue, 20 May 2003 18:50:28



I am using XML Extender Fix Pack 9 (DB2 7.4) and trying to shred an XML
instance that has a unique id as an element under the root element and the
shredding fails, where as when I move the id attributes to be as attributes
to the root element, the shredding succeeds.

If you can help, please read the more technical details ahead, thanks,

Part of the  XML that fails:
----------------------------------------
<ClinicalDocument>
< id root="123" extension="999"/>
  <code code="11488" codeSystem="2.16.840.1.113883.6.1"
displayName="Consultationnote"/>

XML that is shredded well:
------------------------------------
<ClinicalDocument root="123" extension="999">
  <code code="11488" codeSystem="2.16.840.1.113883.6.1"
displayName="Consultationnote"/>

Part of the DAD that fails (see error message below)
------------------------------------------------------------------------
<element_node name="ClinicalDocument">
  <RDB_node>
       <table name="cda_header"  key="id_root id_extension"/>
       <table name="cda_header_names"  key=" id_root id_extension first_name
family_name"/>
       <condition>
        cda_header.id_extension = cda_header_names.id_extension AND
        cda_header.id_root = cda_header_names.id_root
       </condition>
  </RDB_node>
<element_node name="id" multi_occurrence="NO">
  <attribute_node name="extension">
   <RDB_node>
    <table name="cda_header"/>
    <column name="id_extension" type="varchar(64)"/>
   </RDB_node>
  </attribute_node>
  <attribute_node name="root">
   <RDB_node>
    <table name="cda_header"/>
    <column name="id_root" type="varchar(64)"/>
   </RDB_node>
  </attribute_node>
</element_node>
<element_node name="code" multi_occurrence="NO">
   <attribute_node name="code">
    <RDB_node>
     <table name="cda_header"/>
     <column name="code_code" type="varchar(64)"/>
    </RDB_node>
   </attribute_node>
   <attribute_node name="codeSystem">
    <RDB_node>
     <table name="cda_header"/>
     <column name="code_code_system" type="varchar(64)"/>
    </RDB_node>
   </attribute_node>
   <attribute_node name="displayName">
    <RDB_node>
     <table name="cda_header"/>
     <column name="code_display_name" type="varchar(64)"/>
    </RDB_node>
   </attribute_node>
  </element_node>

The DAD that works well:
---------------------------------------
element_node name="ClinicalDocument">
  <RDB_node>
       <table name="cda_header"  key="id_root id_extension"/>
       <table name="cda_header_names"  key=" id_root id_extension first_name
family_name"/>
       <condition>
        cda_header.id_extension = cda_header_names.id_extension AND
        cda_header.id_root = cda_header_names.id_root
       </condition>
  </RDB_node>
<attribute_node name="extension">
   <RDB_node>
    <table name="cda_header"/>
    <column name="id_extension" type="varchar(64)"/>
   </RDB_node>
  </attribute_node>
  <attribute_node name="root">
   <RDB_node>
    <table name="cda_header"/>
    <column name="id_root" type="varchar(64)"/>
   </RDB_node>
  </attribute_node>

The error message :
-------------------------------

Java Shred Stored Procedure Sample
*****************************
Connect to xmltest9

  Calling stored procedure : db2xml.dxxShredXML

 errCode = -126
 msgText = DXXQ044E  Element code does not have an ancestor element

 
 
 

1. XCollection shredding in XML extender

I have just installed XML extender for DB2v7.1.  I have been able to
run the sample sets but have not been able to perform a simple
extension: shredding XML into several columns using XCollection.  When
I construct a very simple DAD and XML file, using jdbc/Shred.java gives
me this error:

  Calling stored procedure : db2xml.dxxShredXML
  COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL1131N
  DARI (Stored Procedure) process has been terminated abnormally.
  SQLSTATE=38503

Does anyone know what this means or how to handle it?  And where are
those cryptic SQLSTATEs documented, anyway?

The simple DAD and XML files are below:

<?xml version="1.0"?>
<!DOCTYPE DAD SYSTEM "c:\dxx\dtd\dad.dtd">
<DAD>
  <validation>NO</validation>
  <Xcollection>
    <prolog>?xml version="1.0"?</prolog>
    <doctype>!DOCTYPE tester SYSTEM "c:\lib\tester.dtd" </doctype>
    <root_node>
        <element_node name="tester">
                <RDB_node>
                        <table name="testonly" key="id"/>
                </RDB_node>
                <element_node name="id">
                        <text_node>
                                <RDB_node>
                                        <table name="testonly"/>
                                        <column name="id"
type="integer"/>
                                </RDB_node>
                        </text_node>
                </element_node>
        </element_node>
    </root_node>
  </Xcollection>
</DAD>

---
<?xml version="1.0"?>
<!DOCTYPE tester SYSTEM "C:\lib\tester.dtd">
<tester><id>23</id></tester>

---
the table was created like this:
create table testonly (id integer not null primary key)

Sent via Deja.com http://www.deja.com/
Before you buy.

2. create autonumber field in a disconnected recordset?

3. Integrating XML with DB2 XML Extender and DB2 Text Extender, SG24-6130-00

4. W2K DLL v EXE stored proc performance issue

5. XML returned from XML Auto, Elements is invalid

6. select different column from table A according to table B

7. XML Shred

8. SELECT SYNTAX PROBLEM

9. XML Bulk Load of a header element into two SQL Server 2000 tables

10. FOR XML returns Incorrect syntax near 'xml

11. XML for Analysis Simple Sample XLS doesn't work w/ASP.NET XML WebControl

12. Broken XML when running queries with FOR XML AUTO and FOR XML EXPLICIT

13. SQL XML Stored Procedure using XML Explicit Returing XML to ASP Page