DB2 - Problem description
Problem IC66942 | Status: Closed |
XML UPDATE REMOVES ELEMENT NAMESPACES WHEN USING "MODIFY DO INSERT <SOURCE-EXPRESSION> AFTER <TARGET-EXPRESSION>" | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
A document can be badly formed when using XML Update to modify a document using "MODIFY DO INSERT <source-expression> AFTER <target-expression>" In certain cases where the <source-expression> is a new element which has the same namespace declarations as the element in <target-expression> the namespaces from the <source-expression> will not be copied into the result document . There is a bug in the code logic which maintains the list of namespaces which are being copied along with the new element from the <source-expression> which results in incorrect results. Scenario below: Original document that needs to be updated: <ns:DataService xmlns:ns="http://www.mci.com/oagis/9"> <ns1:ID xmlns:ns1="http://www.openapplications.org/oagis/9">P9027048</ns 1:ID> <mci:ProvisioningStatus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oa="http://www.openapplications.org/oagis/9" xmlns:mci="http://www.mci.com/oagis/9" xmlns:ns3="http://www.openapplications.org/oagis/9/unqualifiedda tatypes/1.1" xmlns:ns4="http://www.openapplications.org/oagis/9/qualifieddata types/1.1" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="Provisioning"> <oa:Code>NORMAL</oa:Code> </mci:ProvisioningStatus> </ns:DataService> New element we are inserting into original document using update with "insert after" ProvisioningStatus: <mci:MileStone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oa="http://www.openapplications.org/oagis/9" xmlns:mci="http://www.mci.com/oagis/9" xmlns:ns3="http://www.openapplications.org/oagis/9/unqualifiedda tatypes/1.1" xmlns:ns4="http://www.openapplications.org/oagis/9/qualifieddata types/1.1" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <oa:ID schemeName="LegID">OBP</oa:ID> </mci:MileStone> The updated document is badly formed: <ns:DataService xmlns:ns="http://www.mci.com/oagis/9"> <ns1:ID xmlns:ns1="http://www.openapplications.org/oagis/9">P9027048</ns 1:ID> <mci:ProvisioningStatus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oa="http://www.openapplications.org/oagis/9" xmlns:mci="http://www.mci.com/oagis/9" xmlns:ns3="http://www.openapplications.org/oagis/9/unqualifiedda tatypes/1.1" xmlns:ns4="http://www.openapplications.org/oagis/9/qualifieddata types/1.1" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" type="Provisioning"> <oa:Code>NORMAL</oa:Code> </mci:ProvisioningStatus> <mci:MileStone> <--- Missing namespaces (badly formed XML from the update) <oa:ID schemeName="LegID">OBP</oa:ID> </mci:MileStone> </ns:DataService> | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * DB2 LUW All Platforms * **************************************************************** * PROBLEM DESCRIPTION: * * A document can be badly formed when using XML Update to * * modify a * * document using "MODIFY DO INSERT <source-expression> AFTER * * * * <target-expression>" * * * * * * * * In certain cases where the <source-expression> is a new * * element * * which has the same namespace declarations as the element in * * * * <target-expression> the namespaces from the * * <source-expression> * * will not be copied into the result document . There is a bug * * in * * the code logic which maintains the list of namespaces which * * are * * being copied along with the new element from the * * * * <source-expression> which results in incorrect results. * * * * * * * * Scenario below: * * * * * * * * Original document that needs to be updated: * * * * * * * * <ns:DataService xmlns:ns="http://www.mci.com/oagis/9"> * * * * <ns1:ID * * * * xmlns:ns1="http://www.openapplications.org/oagis/9">P9027048</ * 1:ID> * * * * <mci:ProvisioningStatus * * * * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" * * * * xmlns:oa="http://www.openapplications.org/oagis/9" * * * * xmlns:mci="http://www.mci.com/oagis/9" * * * * * * * * xmlns:ns3="http://www.openapplications.org/oagis/9/unqualified * tatypes/1.1" * * * * * * * * xmlns:ns4="http://www.openapplications.org/oagis/9/qualifiedda * types/1.1" * * * * * * xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" * * xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" * * * * xmlns:xsd="http://www.w3.org/2001/XMLSchema" * * * * type="Provisioning"> * * * * <oa:Code>NORMAL</oa:Code> * * * * </mci:ProvisioningStatus> * * * * </ns:DataService> * * * * * * * * New element we are inserting into original document using * * * * update with "insert after" ProvisioningStatus: * * * * * * * * <mci:MileStone * * * * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" * * * * xmlns:oa="http://www.openapplications.org/oagis/9" * * * * xmlns:mci="http://www.mci.com/oagis/9" * * * * * * * * xmlns:ns3="http://www.openapplications.org/oagis/9/unqualified * tatypes/1.1" * * * * * * * * xmlns:ns4="http://www.openapplications.org/oagis/9/qualifiedda * types/1.1" * * * * xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" * * * * xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" * * * * xmlns:xsd="http://www.w3.org/2001/XMLSchema"> * * * * <oa:ID schemeName="LegID">OBP</oa:ID> * * * * </mci:MileStone> * * * * * * * * The updated document is badly formed: * * * * * * * * <ns:DataService xmlns:ns="http://www.mci.com/oagis/9"> * * * * <ns1:ID * * * * xmlns:ns1="http://www.openapplications.org/oagis/9">P9027048</ * 1:ID> * * * * <mci:ProvisioningStatus * * * * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" * * * * xmlns:oa="http://www.openapplications.org/oagis/9" * * * * xmlns:mci="http://www.mci.com/oagis/9" * * * * * * * * xmlns:ns3="http://www.openapplications.org/oagis/9/unqualified * tatypes/1.1" * * * * * * * * xmlns:ns4="http://www.openapplications.org/oagis/9/qualifiedda * types/1.1" * * * * * * xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" * * xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" * * * * xmlns:xsd="http://www.w3.org/2001/XMLSchema" * * * * type="Provisioning"> * * * * <oa:Code>NORMAL</oa:Code> * * * * </mci:ProvisioningStatus> * * * * <mci:MileStone> * * * * <--- Missing namespaces (badly formed * * XML * * from the update) * * * * <oa:ID schemeName="LegID">OBP</oa:ID> * * * * </mci:MileStone> * * * * </ns:DataService> * **************************************************************** * RECOMMENDATION: * * Upgrade to DB2 v97 FP2. * **************************************************************** | |
Local Fix: | |
If possible, use BEFORE instead of AFTER, ie. "modify do insert <source-expression> BEFORE <target-expression>" | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 2 for Linux, UNIX, and Windows | |
Solution | |
The fix is to basically move the call popLevel() (function to remove namespaces from the global namespace list) into the function which pops the current node or exit node. | |
Workaround | |
not known / see Local fix | |
BUG-Tracking | |
forerunner : APAR is sysrouted TO one or more of the following: IC66985 IC67204 IC67888 follow-up : | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 05.03.2010 23.04.2010 23.04.2010 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP2 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.2 |