Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem replacing Null nodes with real values in XML documents...

Dent Arthur DentMay 13 2009 — edited May 14 2009
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...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2009
Added on May 13 2009
2 comments
3,265 views