Adding namespace prefix to the XMLa root element

I am facing a problem in our application. I am assigning an XML content to a XSD variable. While assignment operation is performed the prefix of the XML root element alone is getting replaced with default namespace, though the source XML has the prefix. Please let me know if any patch or workaround is available to address this issue.
Thanks!

Hi All,
we are also facing the same issue, Please provide the solution if anyone knows. We are also using the SOA Suite 11g Version.

Similar Messages

  • Namespace Prefix in the Root Element of the variable

    Hi Gurus,
    We need to call a webservice which requires a namespace prefix at the root elemnt of the xml payload. But as we know that the default behaviour of BPEL removes the prefix so the invoke activity is failing and so we are stuck.
    I found this thread Namespace prefix in Root element missing during variable assignment but i feel the solution specified in this link works only in SOA 10g environment Please let us know what needs to be done?
    Appreciate a prompt response.
    NOTE: SOA Suite Version- 11.1.1.4
    Regards
    Ayush

    Hi All,
    we are also facing the same issue, Please provide the solution if anyone knows. We are also using the SOA Suite 11g Version.

  • Missing namespace prefix in the soap body

    Hello
    The soap body that is produced along with soap header for my webservice. I
    am the client talking to a server. The first piece in RED color is what
    weblogic generates to send to the client but does NOT work. The one below
    though works fine which is what I manipulated by hand to send to the
    server. I have no idea why weblogic drops the namespace prefix in the
    BODY.
    -Narahari
    The message is as shown below
    POST /FS HTTP/1.1
    Host: asgappsrv10:6211
    Content-Type: text/xml; charset=utf-8
    Connection: close
    SOAPAction: "ListDomains"
    <?xml version="1.0" encoding="utf-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <env:Header>
    <n1:Credentials xmlns:n1="urn:criticalpath:fs:api:1.0"
    xsi:type="n1:Credentials">
    <Username xsi:type="xsd:string">admin@default</Username>
    <Password xsi:type="xsd:string">password</Password>
    <SessionId xsi:nil="true"/>
    </n1:Credentials>
    </env:Header>
    <env:Body
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <Fulfill xmlns:n2="urn:criticalpath:fs:api:1.0"
    xsi:type="n2:Fulfill">
    <Request xsi:type="xsd:string">ListDomains</Request>
    <RequestAttributes soapenc:arrayType="n2:Attribute[0]"/>
    <Async xsi:type="xsd:boolean">false</Async>
    </Fulfill>
    </env:Body>
    </env:Envelope>
    When you see the data carefully, the env:Body has the Fulfill element. But
    it does have a namespace prefix on it. This causes the call to fail. If I
    change the above segment manally to look like
    POST /FS HTTP/1.1
    Host: asgappsrv10:6211
    Content-Type: text/xml; charset=utf-8
    Connection: close
    SOAPAction: "ListDomains"
    <?xml version="1.0" encoding="utf-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <env:Header>
    <n1:Credentials xmlns:n1="urn:criticalpath:fs:api:1.0"
    xsi:type="n1:Credentials">
    <Username xsi:type="xsd:string">admin@default</Username>
    <Password xsi:type="xsd:string">password</Password>
    <SessionId xsi:nil="true"/>
    </n1:Credentials>
    </env:Header>
    <env:Body
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <n2:Fulfill xmlns:n2="urn:criticalpath:fs:api:1.0"
    xsi:type="n2:Fulfill">
    <Request xsi:type="xsd:string">ListDomains</Request>
    <RequestAttributes soapenc:arrayType="n2:Attribute[0]"/>
    <Async xsi:type="xsd:boolean">false</Async>
    </n2:Fulfill>
    </env:Body>
    </env:Envelope>

    Hi All,
    we are also facing the same issue, Please provide the solution if anyone knows. We are also using the SOA Suite 11g Version.

  • /BI0/ is not a valid namespace prefix for the organizational criterion

    Hi all,
    I'm getting the below error message when trying to transport 0bpartner that has a 0ORGUNIT as an attribute. I have come across some OSS notes, but those are not applicable to us. I was not able to implement the note is our system.
    We are on 7.3 SP5
    The error mesage is the following:
    Start of the after-import method RS_IOBJ_AFTER_IMPORT for object type(s) IOBJ ( )
    /BI0/ is not a valid namespace prefix for the organizational criterion
    Error SV 771 during after import handling of objects with type(s) IOBJ
    End of after import methode RS_IOBJ_AFTER_IMPORT (Aktivierungsmodus) - runtime: 00:12:19
    Any insight would be appreciated.
    Thanks,
    Voodi

    voodi wrote:
    Hi all,
    >
    > I'm getting the below error message when trying to transport 0bpartner that has a 0ORGUNIT as an attribute. I have come across some OSS notes, but those are not applicable to us. I was not able to implement the note is our system.
    >
    > We are on 7.3 SP5
    >
    >
    > The error mesage is the following:
    >
    >  Start of the after-import method RS_IOBJ_AFTER_IMPORT for object type(s) IOBJ ( )
    >  /BI0/ is not a valid namespace prefix for the organizational criterion
    >  Error SV 771 during after import handling of objects with type(s) IOBJ
    >  End of after import methode RS_IOBJ_AFTER_IMPORT (Aktivierungsmodus) - runtime: 00:12:19
    >
    >
    > Any insight would be appreciated.
    >
    > Thanks,
    > Voodi
    Hi Voodi,
    I strongly think this could be a authorzaiton issue.
    Have you checked the error log? More references : http://goo.gl/9554m ; SAP Note 731973
    Methods
    1. Activate and adjust table /bi0/pbpartner
    2. Activate and adjust table /bi0/morgunit
    3.Run program RSDG_IOBJ_ACTIVATE
    4 Repair info object using program RSDG_IOBJ_REORG
    5. If none of the above help run the program RSDMD_CHECKPRG_ALL with repair mode checked for 0ORGUNIT.
    Possible cases:
    1. Goto RSRV - SID Values in X and Y Tables for 0BPARTNER. If not try activation using RSDG_IOBJ_ACTIVATE
    2. Check changes : If you add new objects to 0BPARTNER then you should also collect that newly added object , collecting only 0BPARTNER is not enough.
    3. If 0BPARTNER is inactive in Q, pls collect it in a request and try to re transport and check.
    Best Regards, @{

  • Remove namespace prefix with the XMLAnonymizerBean is possible at SOAP Adap

    Hello,
    I am wondering is it possible Remove namespace prefix with the XMLAnonymizerBean at SOAP Receiver Adaptor?
    Thanks

    Hi Rajiv,
    Pl. go through this blog:
    /people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean
    Also if you want to use this at sender side, SOAP adapter will not support. Please check stefans reply in this thread:
    XMLAnonymizerBean doesnt work
    Regards,
    ---Satish

  • Removing the dummy root element

    Looks like I created a topic that cannot
    be replied to! The topic maintainers will
    have to delete it.
    After looking at the XMLSample code I realized my mistake... oops!
    A quick edit turned off the <root>
    containment. Not sure why it's there in
    the sample in the first place.
    For anyone else who tries this, here's the
    change to remove the dummy root element:
    The new code in XMLSample.java is:
    out.appendChild(result);
    instead of:
    // create a dummy document element for the
    // output document
    Element root = out.createElement("root");
    out.appendChild(root);
    // append the transformed tree to the dummy
    // document element
    root.appendChild(result);
    null

    Hi,
    Please try deleting the xml files corresponding to the dimensions from the backend and try opening the dimension member sheet.
    For deleting the XML file follow the workaround in my reply of the below thread,
    Re: Master data issue in CV
    Hope this helps,
    Regards,
    G.Vijaya Kumar

  • Namespace prefix in Root element missing during variable assignment in SOA Suite 11g

    I need qualified element Namespaces in one of the target variables. All elements being referred to would have the namespace prefixed. This is working for all child elements, but not the for root element. How can i get the root element prefixed with the namespace?
    We are using SOA Suite 11g and the Jdeveloper version we are using is 11.1.1.6.0
    when i use transform operation to populate the target variable the variable gets populated something like this :
    <inputVariable>
    <part  name="payload">
    <Message>
    <msg:Header>
    <head:field1>xxxxxx</head:field1>
    <head:field2>2013-07-09T08:00:55</head:field1>
    </msg:Header>
    </Message>
    But the actual output we need is
    <inputVariable>
    <part  name="payload">
    <msg:Message>
    <msg:Header>
    <head:field1>xxxxxx</head:field1>
    <head:field2>2013-07-09T08:00:55</head:field1>
    </msg:Header>
    </msg:Message>
    We tried the fix suggested in one of the SOA threads but its not working for us and looks like that will work only for SOA SUITE 10g.
    Please provide us any help/suggestions if anyone know the solution.
    Thank you in advance for the help.

    Any one can help us please.......

  • How to add namespace prefix to root tag in XSL version 1.1  SOA 11g

    Hi Experts,
       Can any one post solution for adding namespace prefix to root tag using XSL version 1.1 in SOA 11g?
    I have tried the below options and none is working.
    1. Removing prefix add in exclude-prefixes in XSL.But still seeing no prefix for root tag.
    2. Added the <xsl-element>   tag with namespace.But it is not working
    3. Added the below XSL code and it is not working.
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:ns0="https://api.ladbrokes.com/v1/sportsbook-couchbase/Temp.xsd">
      <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
      <xsl:template match="@* | node()">
       <xsl:copy>
       <xsl:apply-templates select="@* | node()"/>
       </xsl:copy>
      </xsl:template>
      <xsl:template match="/*">
       <xsl:element name="ns0:{local-name()}">
       <xsl:copy-of select="namespace::*" />
       <xsl:apply-templates select="@* | node()" />
       </xsl:element>
      </xsl:template>
    </xsl:stylesheet>

    Try this:
    <xsl:stylesheet  version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="@*|text()|comment()|processing-instruction()">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="/">
            <RootTag xmlns:ns0="https://api.ladbrokes.com/v1/sportsbook-couchbase/Temp.xsd">
                <xsl:apply-templates select="@*|node()"/>          
            </RootTag >
        </xsl:template>
        <xsl:template match="*">
            <xsl:element name="{local-name()}">
                <xsl:apply-templates select="@*|node()"/>
            </xsl:element>
        </xsl:template>
    </xsl:stylesheet>

  • Multiple Root elements in the XSD Schema

    Hi Dear MDM gurus,
    I have manually created an XSD Schema and I can import it in the Syndicator without any problem.
    I have 3 different Root elements in the schema that I want to use and map to the corresponding table of this type.
    In my Syndicator screen in the Rood dropdown box I can see all three of the Root elements that I have in the schema.
    If I select the first Root element - everything goes fine and I can do my mapping, save the map, etc.
    The problem is that if I select the second or third root element to do the mapping for them, the syndicator does not show the structure in the Item Mapping after that.
    I tried moving the Second root element of the schema and make it first and it works with it, but then the other two are not appearing and I have the same issue.
    Does MDM support only one Root element in the Schema? If that's the case, why does it show all three of them in the dropdown?
    Here is an example:
    1. If I have them in this order in my XSD
              <xs:element name="ManufacturerGroupNumber" type="ManufacturerGroupNumbers"/>
              <xs:element name="SupplierGroupNumber" type="SupplierGroupNumbers"/>
              <xs:element name="SupplierLocationNumber" type="Suppliers"/>
    I can only see the structure when I select the "ManufacturerGroupNumber".
    2. If I have them in the Schema in this order
              <xs:element name="SupplierLocationNumber" type="Suppliers"/>
              <xs:element name="SupplierGroupNumber" type="SupplierGroupNumbers"/>
              <xs:element name="ManufacturerGroupNumber" type="ManufacturerGroupNumbers"/>
    I can only see the structure when I select the first one again "SupplierLocationNumber" and I can only do the mapping for it.
    Any help would be appreciated.
    Thanks in advance,
    Boris

    Hello Satish,
    Thank you for your quick response.
    I read some of the architectural approaches and XML specifications and depending on your design, you may have only one Root element or in rare cases Several Root elements. In my case, I was advised by our PI experts to use Multiple Root elements and this gives me the following:
    Advantages:
    u2022 The reusability of the schema definition is available for all types and all elements defined in the global namespace.
    Disadvantages:
    u2022 Since there are many global elements, there are many valid XML documents.
    I initially had the schema as you suggested, but they didn't like it in PI and advised me to change it with having multiple roots.
    What I'm trying to figure out is if there is a bug in MDM that does not allow to use the rest of the root elements, so I can open an OSS message.
    Thanks,
    Boris

  • Adding a heading to the steps element in a DITA topic

    Hello Framers,
    I've been using unstructured FM for years, but I've only just started looking into structured FM. I am currently trying to adjust the sample DITA application that comes with FM 9 to our requirements. In the DITA task topic, the sample application adds frames from a reference page above and below the steps element. Both frames contain a line to visually separate the steps element from other elements in the topic. The upper frame also contains a heading for that element.
    I don't like this approach at all. First of all, I don't want translatable text on the reference page. In addition, the heading should go to the side-head area. The EDD contains the following rules for the steps element:
    Automatic insertions
      Automatically insert child: step
        and nested child: cmd
    Format rules for first paragraph in element
      In all contexts.
        Use paragraph format: step.begin
    Format rules for last paragraph in element
      In all contexts.
        Basic properties
          Paragraph spacing
            Change space below by: +6pt
          Pagination properties
            Keep with previous: Yes
          Advanced properties
            Frame below element: StepsEnd
    I was thinking about adding a prefix to the steps element, but in this case, the prefix is formatted as the first step with the step.begin paragraph style. Is it possible to define a formatting rule for the second paragraph in an element?
    Thank you for any help
    Susanne

    Maybe it is time to rethink what you need to do.
    Just because FrameMaker ships DITA with styles that put a frame above and below the steps element, does not mean that you have to do it also. You can delete it from the EDD.
    If you need your steps to have a heading, then use the heading (or title) element in one of the containing elements higher up the hierarchy, such as the taskbody. I do not use DITA but my structure has a procedure element that is something like:
    Procedure
       Title
       Intro
       Step
       Step
    The Title element contains the title or heading or the procedure. The Intro element contains introductory material for the procedure. Typically, the title is in the side head, which aligns with the first paragraph in the Intro. If there is no Intro element, then the title aligns with first Step element. This structure is simpler than the standard DITA structure, but my point is that the title of your procedure (or steps) need not be part of the steps element itself; my guess is that the DITA structure has a place for it higher up the hierarchy.

  • Changing the namespace prefix in OSB body content

    I would like to change the namespace prefix of the namespace in the content of the Body in OSB (Replacing g: with dg:)
    For example:
    <g:Information>
    <g:firtName>John<g:firstName>
    <nc:date>1970-01-01<nc:date>
    </g:Information>
    should become
    <dg:Information>
    <dg:firtName>John<dg:firstName>
    <nc:date>1970-01-01<nc:date>
    </dg:Information>
    Any idea how can I do this?

    Re: Namespace replace/rename issue in ALSB
    Regards,
    Anuj

  • Root element required error in syndication

    Hi,
    We have added few new fields into the main table. Now accordingly we need to update the Oubound map to include these new fields. I have created a new XSD file having these new fields. But when I try to use this in syndicator to update, it throws me an error back saying "Root element required". I checked in SDN but couldnt find enough clues.
    Any pointers will be highly appreciated.
    Regards,
    Ponraj M

    Hello,
    There are few possible root causes to this error appearing in MDM Syndicator:
    1. This error indicates that the XSD is not valid as there is no declaration of the root element.
    If you try to validate this XSD in XMLspy you will receive a similar error.
    2. The XSD declares the root element but it does not appear in the XML.
    If you validate the XML against the XSD in XMLspy you will receive a similar error.
    3. An illegal character in the XSD root element declaration makes it impossible for Syndicator to detect it.
    Please check these possible causes.
    Best regards,
    Hedda Cohen.

  • XML Namespace Prefix Lost

    I am working on a RFC to JMS scenario and am having trouble getting the XML in the required format.  I have loaded the XML file provided in my mapping.  However the result was not what I had anticipated.
    <br>
    This is the XML provided and what I want to produce:
    <br>
    <
    ?xml version="1.0" encoding="UTF-8" ?>  <br>
    <MyNS3:Maint_Struc <br>
       xmlns:MyNS1="http://www.MyTest.com/My_Namespace/Part1"   <br>
       xmlns:MyNS2="http://www.MyTest.com/My_Namespace/Part2"   <br>
       xmlns:MyNS5="http://www.MyTest.com/My_Namespace/Part5"   <br>
       xmlns:MyNS3="http://www.MyTest.com/My_Namespace/Part3"   <br>
       xmlns:MyNS4="http://www.MyTest.com/My_Namespace/Part4"   <br>
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        <br>
       xsi:schemaLocation="www.MyTest.com/My_Namespace/Part3 file:/C:/MyStructure.xsd">
    <br>
       <
       MyNS2:SubStruc_1>   <br>
         <
         MyNS2:Fld_1_1_A>Value001<
         /MyNS2:Fld_1_1_A>  <br>
         <
         MyNS2:Fld_1_1_B>Value002<
         /MyNS2:Fld_1_1_B> <br>
       <
       /MyNS2:SubStruc_1> <br>
    <br>
       <
       MyNS3:SubStruc_2>  <br>
          <
          MyNS1:SubStruc_2_1>  <br>
            <
            MyNS1:Fld_2_1_A>Value003<
            /MyNS1:Fld_2_1_A>   <br>
            <
         MyNS1:Fld_2_1_B>Value004<
    /MyNS1:Fld_2_1_B>  <br>
          <
    /MyNS1:SubStruc_2_1>  <br>
          <
    MyNS4:Fld_2_A>Value005<
    /MyNS4:Fld_2_A>  <br>
          <
    MyNS4:Fld_2_B>Value006<
    /MyNS4:Fld_2_B>  <br>
       <
    /MyNS3:SubStruc_2>  <br>
    <br>
       <
    MyNS3:SubStruc_3>  <br>
          <
    MyNS5:SubStruc_3_1>  <br>
             <
    MyNS5:Fld_3_1_A>Value007<
    /MyNS5:Fld_3_1_A>  <br>
             <
    MyNS5:Fld_3_1_B>Value008<
    /MyNS5:Fld_3_1_B>  <br>
          <
    /MyNS5:SubStruc_3_1> <br>
          <
    MyNS3:Fld_3_A>Value009<
    /MyNS3:Fld_3_A>  <br>
          <
    MyNS5:Fld_3_B>Value010<
    /MyNS5:Fld_3_B>  <br>
          <
    MyNS2:Fld_3_C>Value011<
    /MyNS2:Fld_3_C>  <br>
       <
    /MyNS3:SubStruc_3>  <br>
    <
    /MyNS3:Maint_Struc>  <br>
    <br>
    However I am getting the following when mapped: <br>
    <
    ?xml version="1.0" encoding="UTF-8"?> <br>
    <
    ns0:Maint_Struc   <br>
       xmlns:MyNS4="http://www.MyTest.com/My_Namespace/Part4"  <br>
       xmlns:MyNS5="http://www.MyTest.com/My_Namespace/Part5"  <br>
       xmlns:MyNS2="http://www.MyTest.com/My_Namespace/Part2"  <br>
       xmlns:MyNS1="http://www.MyTest.com/My_Namespace/Part1"  <br>
       xmlns:ns0="http://www.MyTest.com/My_Namespace/Part3"  <br>
       xmlns:ns1="http://www.w3.org/2001/XMLSchema-instance"  <br>
       ns1:schemaLocation="www.MyTest.com/My_Namespace/Part3 file:/C:/MyStructure.xsd"> <br>
       <
    ns2:SubStruc_1 xmlns:ns2="http://www.MyTest.com/My_Namespace/Part2">  <br>
          <
    ns2:Fld_1_1_A>Value001<
    /ns2:Fld_1_1_A>  <br>
          <
    ns2:Fld_1_1_B>Value002<
    /ns2:Fld_1_1_B>  <br>
       <
    /ns2:SubStruc_1>  <br>
    <br>
       <
    ns0:SubStruc_2>  <br>
          <
    ns3:SubStruc_2_1 xmlns:ns3="http://www.MyTest.com/My_Namespace/Part1">  <br>
             <
    ns3:Fld_2_1_A>Value003<
    /ns3:Fld_2_1_A>  <br>
             <
    ns3:Fld_2_1_B>Value004<
    /ns3:Fld_2_1_B>  <br>
          <
    /ns3:SubStruc_2_1>  <br>
          <
    ns4:Fld_2_A xmlns:ns4="http://www.MyTest.com/My_Namespace/Part4">Value005<
    /ns4:Fld_2_A>  <br>
          <
    ns4:Fld_2_B xmlns:ns4="http://www.MyTest.com/My_Namespace/Part4">Value006<
    /ns4:Fld_2_B>  <br>
       <
    /ns0:SubStruc_2>  <br>
    <br>
       <
    ns0:SubStruc_3> <br>
          <
    ns5:SubStruc_3_1 xmlns:ns5="http://www.MyTest.com/My_Namespace/Part5"> <br>
             <
    ns5:Fld_3_1_A>Value007<
    /ns5:Fld_3_1_A>  <br>
             <
    ns5:Fld_3_1_B>Value008<
    /ns5:Fld_3_1_B> <br>
          <
    /ns5:SubStruc_3_1>  <br>
          <
    ns0:Fld_3_A>Value009<
    /ns0:Fld_3_A>  <br>
          <
    ns5:Fld_3_B xmlns:ns5="http://www.MyTest.com/My_Namespace/Part5">Value010<
    /ns5:Fld_3_B>  <br>
          <
    ns2:Fld_3_C xmlns:ns2="http://www.MyTest.com/My_Namespace/Part2">Value011<
    /ns2:Fld_3_C>  <br>
       <
    /ns0:SubStruc_3>  <br>
    <
    /ns0:Maint_Struc>  <br>
      <br>
    Things that are wrong with the mapped XML:  <br>
    - the namespace "http://www.MyTest.com/My_Namespace/Part3" was prefixed with MyNS3 but XI reassigned it to ns0
      <br>- original prefixes are not used in the element tags  <br>
      <br>
    Appreciate if anyone can help.  <br>
    Thanks.

    Thank you for all your valuable suggestions.  Does any know why XI/PI does not acknowledge/use the namespace prefix that is defined in the XML?  Is there no other way around this short-coming apart from using XSLT mapping? 
    <br>
    I did try using the anonymizer (as suggested by Manjusha).  With the anonymizer I am able to change the namespace prefix in the element tags to the way I want it.  However the namespace definition is still showing in the element tag.
    <br>
       <MyNS2:SubStruc_1 xmlns:MyNS2="http://www.MyTest.com/My_Namespace/Part2">  <br>
          <MyNS2:Fld_1_1_A>Value001</MyNS2:Fld_1_1_A>  <br>
          <MyNS2:Fld_1_1_B>Value002</MyNS2:Fld_1_1_B>  <br>
       </MyNS2:SubStruc_1>  <br>
      <br>
    This is almost perfect only if I am able to remove the definition xmlns:MyNS2="http://www.MyTest.com/My_Namespace/Part2" from the element tag.  Suggestion any one?
    Thanks All.

  • SQL function to extract XML namespace prefix

    Hi,
    I have the following document
    <ns4:product xmlns:ns1="www.abc.com" xmlns:ns2="www.def.com" xmlns:ns3="www.ghi.com" xmlns:ns4="www.jkl.com">
    <ns4:productline>Widget</ns4:productline>
    </ns4:product>
    I'm trying to find a SQL function which will enable me to extract the namespace prefix with the value "www.jkl.com". This is so that I can then use the prefix as part of the xpath expression to search for an element value in the document eg. extractvalue('/ns4:product/ns4:productline')
    Thanks

    Try DBMS_XMLDOM.GetNameSpace

  • Extracting a namespace prefix

    Hi,
    I have the following document
    <ns4:product xmlns:ns1="www.abc.com" xmlns:ns2="www.def.com" xmlns:ns3="www.ghi.com" xmlns:ns4="www.jkl.com">
    <ns4:productline>Widget</ns4:productline>
    </ns4:product>
    I'm trying to find a SQL function which will enable me to extract the namespace prefix with the value "www.jkl.com". This is so that I can then use the prefix as part of the xpath expression to search for an element value in the document eg. extractvalue('/ns4:product/ns4:productline')
    Thanks

    Hi,
    This one's tricky, so tricky that I think it's not possible using Oracle built-in XML DML functions.
    Even XQuery Update cannot do it (for now) because, likewise, the prefix is always redeclared at child level.
    The only thing I can think of is XSLT (or maybe DOM manipulation) :
    SQL> select xmlserialize(document
      2           xmltransform(
      3             xmltype('<A xmlns="namespace" xmlns:def="myns_namespace"/>')
      4           , xmltype(
      5  '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      6     xmlns:def="myns_namespace"
      7     xmlns:ns0="namespace">
      8    <xsl:template match="ns0:A">
      9      <xsl:copy>
    10        <xsl:element name="def:B"/>
    11      </xsl:copy>
    12    </xsl:template>
    13  </xsl:stylesheet>')
    14         )
    15        indent
    16      )
    17  from dual;
    XMLSERIALIZE(DOCUMENTXMLTRANSF
    <A xmlns="namespace" xmlns:def="myns_namespace">
      <def:B/>
    </A>

Maybe you are looking for