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!

Extract XML fragment without namespace

WhatwasthatNov 4 2013 — edited Nov 5 2013

Hi I need to do some XML manipulation and for the PL/SQL block below the extracted xml has added namespaces to the tags

ie  it is this

  <g:EntityId xmlns:g="http://www.something/Entity/Core/V1.0">

instead of this

  <g:EntityId>

Is there any way to stop this, or if not then I assume I will need to use string/clob functions to extract the relevant portion?

declare

v_request     naps.soap_api.t_request;

v_response      soap_api.t_response;

v_body           CLOB;

v_tmpXML         XMLType;

  BEGIN

v_tmpXML := XMLTYPE('<GetEntitySummaryResponse xmlns:a="http://www.something/Accreditation/Core/V1.0"

xmlns:b="http://www.something/Address/Core/V1.0"

xmlns:c="http://www.something/AgedCareServiceProvider/Core/V1.0"

xmlns:d="http://www.something/Contact/Core/V1.0" xmlns:e="http://www.something/Data/Services/V1.0"

xmlns:f="http://www.something/Enterprise/Core/V1.0" xmlns:g="http://www.something/Entity/Core/V1.0"

xmlns:h="http://www.something/Integration/Notification/Services/Data/Entity/V1.0"

xmlns:i="http://www.something/Messaging/Core/V1.0"

xmlns:j="http://www.something/Name/Core/V1.0"

xmlns:k="http://www.something/Organisation/Core/V1.0"

xmlns:l="http://www.something/Person/Core/V1.0"

xmlns:m="http://www.something/Prudential/Core/V1.0"

xmlns:n="http://www.something/ServiceOffering/Core/V1.0"

xmlns:o="http://www.something/Site/Core/V1.0"

xmlns:p="http://www.something/Status/Core/V1.0">

            <i:DataGroup>address</i:DataGroup>

            <f:Id>

               <f:Value>169</f:Value>

               <f:Type>Address.Id</f:Type>

               <f:Qualifier>ADDRESSES</f:Qualifier>

            </f:Id>

            <b:Address>

               <g:EntityId>

                  <g:EntityTypes>

                     <g:EntityType>Address</g:EntityType>

                  </g:EntityTypes>

                  <g:Identifiers>

                     <g:Identifier>

                        <g:Value>169</g:Value>

                     </g:Identifier>

                  </g:Identifiers>

               </g:EntityId>

               <b:AddressLine1>"Karoo"</b:AddressLine1>

               <b:SiteName>"Karoo"</b:SiteName>

               <b:Suburb>JINGELLIC</b:Suburb>

               <b:AddressTenancies>

                  <b:AddressTenancy>Physical</b:AddressTenancy>

               </b:AddressTenancies>

            </b:Address>

         </GetEntitySummaryResponse>');

     v_tmpXML := v_tmpXML.extract('/GetEntitySummaryResponse/b:Address',

                                     'xmlns:p="http://www.something/Integration/Notification/Services/Data/Entity/V1.0" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.something/Accreditation/Core/V1.0" xmlns:b="http://www.something/Address/Core/V1.0" xmlns:c="http://www.something/AgedCareServiceProvider/Core/V1.0" xmlns:d="http://www.something/Contact/Core/V1.0" xmlns:e="http://www.something/Data/Services/V1.0" xmlns:f="http://www.something/Enterprise/Core/V1.0" xmlns:g="http://www.something/Entity/Core/V1.0" xmlns:h="http://www.something/Integration/Notification/Services/Data/Entity/V1.0" xmlns:i="http://www.something/Messaging/Core/V1.0" xmlns:j="http://www.something/Name/Core/V1.0" xmlns:k="http://www.something/Organisation/Core/V1.0" xmlns:l="http://www.something/Person/Core/V1.0" xmlns:m="http://www.something/Prudential/Core/V1.0" xmlns:n="http://www.something/ServiceOffering/Core/V1.0" xmlns:o="http://www.something/Site/Core/V1.0" xmlns:p="http://www.something/Status/Core/V1.0"');

dbms_output.put_line(v_tmpXML.getClobVal());

end ;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 3 2013
Added on Nov 4 2013
9 comments
5,226 views