This discussion is archived
2 Replies Latest reply: Nov 4, 2013 4:09 AM by Whatwasthat RSS

Change namespace names

Whatwasthat Newbie
Currently Being Moderated

Given an XML I need to just pass it through to another system but with different namespace names. I can use XSLT I guess but I'm not familiar with it and there are 9-10 quite large XML.Can this be done simply? I'm actually leaning towards using  REPLACE('<f:','<version10:') taking into account CDATA tags.

 

For:

declare

vv xmlType;

begin

 

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

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

xmlns:i="http://www.something/Messaging/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>

</GetEntitySummaryResponse>');

dbms_output.put_line(vv.getClobVal());

END;

 

To:

 

declare

vv xmlType;

begin

 

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

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

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

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

            <Version12:DataGroup>address</Version12:DataGroup>

            <Version10:Id>

               <Version10:Value>169</Version10:Value>

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

               <Version10:Qualifier>ADDRESSES</Version10:Qualifier>

            </Version10:Id>

</GetEntitySummaryResponse>');

dbms_output.put_line(vv.getClobVal());

END;

  • 1. Re: Change namespace names
    odie_63 Guru
    Currently Being Moderated

    Given that you don't change the namespace URI that the prefix refers to, the two versions are completely equivalent for an XML parser.

     

    What kind of system relies on namespace prefixes instead of URIs?

  • 2. Re: Change namespace names
    Whatwasthat Newbie
    Currently Being Moderated

    An xml is being built using the response of another webservice.. The xml I'm building will go through two more layers another team is building before eventually reaching the end system for extraction of data. I guess I could try and push it through with different namespace names.to see what happens but I thought I'd try and get it exactly right before trying.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points