8 Replies Latest reply: Jul 24, 2013 10:37 AM by odie_63 RSS

    DeleteXml() causing xml data format error in database

    alexjingsi

      Hi, guys,

        I'm using the oracle  xml db 11g in my website application. Last week I found that using the deletexml() to delete a node in the xml may cause a terrible problem that the rest data in the database had wrong xml format. I wonder is it a bug when using binary xml storage.

        My xml data is describe below,

       

      <root>

           <nodes>

                <node id="1">

                     <name>John</name>

                     <age>16</age>

                     <hobby>football</hobby>

                </node>

                <node id="2">

                     <name>Alex</name>

                     <age>22</age>

                     <hobby>table tenisl</hobby>

               </node>

                .....

           <nodes>

      </root>

       

        I using deletexml() to delete just a node once time,

      "update projects set object_value=deletexml(object_value, '/root/nodes/node[@id="1"]')"

      Usually it successes and the rest data is as excepted, but sometime, I find that after deleting a node, any query in the database except "select * from projects" gets null. And the rest data has wrong format like below,

      <root>

           <nodes>

                <node id="1">

                     <name>John</name>

                     <age>/hobby>

                </node>

                <node id="2">

                     <name>Alex</name>

                     <age>22</age>

                     <hobby>table tenisl</hobby>

               </node>

                .....

           <nodes>

      </root>

      Just one format error causes the whole xml data valueless, but it seems that in most time the deletexml() works well, does anyone knows what happens?

      Thanks a lot.