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!

Add "ns1:" to an xml tag in a PLSQL

Arun ThomasMar 30 2015 — edited Mar 30 2015

Hi Friends,

in the below xml

i use DomNode approach to create the core XML

and use the below query

SELECT XMLSERIALIZE ( DOCUMENT xmlroot  

                              (XMLELEMENT ( 

                               "ns1:DeriveCoverageRequest", 

                               xmlattributes ( 

                                  'urn:xyz:ccw:config:common:data' AS "xmlns", 

                                  'urn:xyz:ccw:config:msa:data' AS "xmlns:ns1"), 

                               l_xmltype)  

                               ,version '1.0" encoding="UTF-8' ,STANDALONE YES 

                               ) 

                               AS CLOB) 

                               into l_value

and the XML look like

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ns1:DeriveCoverageRequest xmlns="urn:xyz:ccw:config:common:data" xmlns:ns1="urn:xyz:ccw:config:msa:data">

  <majorLine> --

    <lineId>47285</lineId>

    <itemName>xyz15454</itemName>

    <quantity>5</quantity>

    <minorLine>

      <lineId>47293</lineId>

      <itemName>15454-CC-FTA</itemName>

      <quantity>5</quantity>

      <itemPath>xyz15454:15454-</itemPath>  

    </minorLine>

  </majorLine>

</ns1:DeriveCoverageRequest>

from dual;

now i need to add ns1: with the majorLine tag so it should be like

<ns1:majorLine>

</ns1:majorLine>

Code for creating this majorLine is

  l_major_line_node :=

      DBMS_XMLDOM.

       appendChild (

         l_root_node,

         DBMS_XMLDOM.

          makeNode (DBMS_XMLDOM.createElement (l_domdoc, 'majorLine')));

and i modified like

  l_major_line_node :=

      DBMS_XMLDOM.

       appendChild (

         l_root_node,

         DBMS_XMLDOM.

          makeNode (DBMS_XMLDOM.createElement (l_domdoc, 'ns1:majorLine')));

but it did not work. could you please suggest some idea on this

This post has been answered by odie_63 on Mar 30 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2015
Added on Mar 30 2015
10 comments
2,076 views