Problem replacing Null nodes with real values in XML documents...
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
Our friends in Java land are insisting on passing data between Java and PL/SQL using fairly small XML documents (don't ask). I then need to extract the input parameter values and pass them, on to the stored procedures that actually do the work. These return a result which needs to be returned to the java layer in the output XML document.
Here is a cut down version of the input XML...
<ParameterList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameter>
<Id>1</Id>
<Result xsi:nil="true"/>
</Parameter>
<Parameter>
<Id>2</Id>
<Result xsi:nil="true"/>
</Parameter>
</ParameterList>
and this is an example of what I am expected to return...
<ParameterList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameter>
<Id>1</Id>
*<Result>SUCCESS</Result>*
</Parameter>
<Parameter>
<Id>2</Id>
*<Result>WARNING</Result>*
</Parameter>
</ParameterList>
i.e. I am expected to replace the value of the Result node with a string indicating the succes or otherwise of the underlying PL/SQL process.
I am extracting the input values using the DBMS_XMLDOM functions and naively assumed that DBMS_XMLDOM.SETNODEVALUE could be used to update the value in the Result node - It didn't work so I resorted to reading the documentation which revealed that it will not work for a null node.
Am I going to have to use XSLT to generate the output XML from the Input and incorprate the result? Or is there a simpler way?
I have used XSLT in Oracle before and still have the nervous tick...