Change XML Namespace in XML

Hi gurus,
i have imported an XSD file as an external definition and use this for a mapping. After my mapping i have an xml file like:
  <?xml version="1.0" encoding="UTF-8" ?>
- <ns1:Aviso xmlns:ns1="http://Post.AG/PartnerInterface/Schemas/PVSdeAt/Aviso_V1.0">
- <ns2:Header xmlns:ns2="http://PostAG.PartnerInterface.Schemas.PVS_deAt.AvisoHeader">
  <ns2:DebitorAuftraggeber>0022022315</ns2:DebitorAuftraggeber>
  <ns2:Kundenname>WNT Deutschland GmbH</ns2:Kundenname>
  <ns2:Erstellungsdatum>2009-06-26T16:12:25</ns2:Erstellungsdatum>
  <ns2:Versanddatum>2009-06-26T16:12:25</ns2:Versanddatum>
  </ns2:Header>
- <ns3:Absender xmlns:ns3="http://PostAG.PartnerInterface.Schemas.PVS_deAt.AvisoShipper">
  <ns3:Absendername1>WNT Deutschland GmbH</ns3:Absendername1>
  <ns3:Absendername2 />
  <ns3:Absendername3 />
  <ns3:Absendername4 />
Now the question is how to change the namespace tags ns1 ns2 ns3? The target XML-File should view like this: (ns1 = ns0; ns2 = ns1; ns3 = ns2)
  <?xml version="1.0" encoding="UTF-8" ?>
- <ns0:Aviso xmlns:ns1="http://Post.AG/PartnerInterface/Schemas/PVSdeAt/Aviso_V1.0">
- <ns1:Header xmlns:ns2="http://PostAG.PartnerInterface.Schemas.PVS_deAt.AvisoHeader">
  <ns1:DebitorAuftraggeber>0022022315</ns2:DebitorAuftraggeber>
  <ns1:Kundenname>WNT Deutschland GmbH</ns2:Kundenname>
  <ns1:Erstellungsdatum>2009-06-26T16:12:25</ns2:Erstellungsdatum>
  <ns1:Versanddatum>2009-06-26T16:12:25</ns2:Versanddatum>
  </ns1:Header>
- <ns2:Absender xmlns:ns3="http://PostAG.PartnerInterface.Schemas.PVS_deAt.AvisoShipper">
  <ns2:Absendername1>WNT Deutschland GmbH</ns3:Absendername1>
  <ns2:Absendername2 />
  <ns2:Absendername3 />
  <ns2:Absendername4 />
Thanks a lot,
Max

Hi,
you can use a XSLT mapping as step within you Interface mapping to change the namespace tags. Just make sure the produced message matches the XSD structure (external definition) of the destination message interface.
Check:
http://www.w3schools.com/xsl/
http://www.w3.org/TR/xslt
Regards,
Kai

Similar Messages

  • XML namespace in xml converted pdf

    Hello everyone
    I have a problem when converting pdf's in xml. Everytime when I convert a PDF(either with Acrobat or with mailing the file as XML) in XML the date fields always in middle shows the xml namespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" . We are using these xml's to transfer data to an accounting software but the software recognizes the xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" as an error and because of that the data couldn't be uploaded. We created the PDF using a xsd scheme made in the accounting software. Is there a way to get rid of xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" showing in the date fields.
    I appreciate every possible help

    Hi,
    It sounds like you have the nillable="true" attribute in you XSD for the date field.
    If you XSD looks like;
    <xs:element name="Date1" type="xs:date" nillable="true"/>
    Then you will get the following when the field Date1 is bound to is left blank.
    <Date1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
    This is the correct behaviour, so I am either not understanding the problem or there is a bug in the accounting software you are using.
    Maybe you could try replacing the nullable="true" with a minOccurs="0".  This will mean the element will not appear in the XML at all.
    Regards
    Bruce

  • What is the best way to change a namespace in an xml document

    Hi,
    I need to change an xml namespaces. The xml has about 200 elements and every element may have a namespace attribute (namespaces are all the same).
    Is there any better solution then the following function?
    SQL> create or replace function change_namespace(p_xml xmltype, p_namespace varchar2) return xmltype is
      2    l_doc dbms_xmldom.DOMDocument;
      3    l_nodes dbms_xmldom.DOMNodelist;
      4    l_node dbms_xmldom.DOMNode;
      5  begin
      6    l_doc:=dbms_xmldom.NewDOMDocument(p_xml);
      7    l_nodes:=dbms_xmldom.getElementsByTagName(l_doc,'*');
      8    for i in 0..dbms_xmldom.getlength(l_nodes)-1 loop
      9      l_node:=dbms_xmldom.item(l_nodes,i);
    10      if i=0 then
    11        --set namespace only for the root node
    12        dbms_xmldom.setattribute(dbms_xmldom.makeElement(l_node),'xmlns',p_namespace);
    13      else
    14        --remove all the other namespaces
    15        dbms_xmldom.removeattribute(dbms_xmldom.makeElement(l_node),'xmlns');
    16      end if;
    17    end loop;
    18 
    19    return dbms_xmldom.getxmltype(l_doc);
    20  end;
    21  /
    Function created.
    SQL> select change_namespace(xmltype('<a xmlns="aaa"><b xmlns="aaa">4</b><c>44</c></a>'),'newnamespace')
      2  from dual;
    CHANGE_NAMESPACE(XMLTYPE('<AXMLNS="AAA"><BXMLNS="AAA">4</B><C>44</C></A>'),'NEWN
    <a xmlns="newnamespace">                                                       
      <b>4</b>                                                                     
      <c>44</c>                                                                    
    </a> Ants

    Hi,
    I found a better and almost 10x faster way to remove the namespaces, using xsl.
    here's the original xsl with a little modifications http://bytes.com/forum/thread448445.html
    SQL> with t as (select xmltype('<a xmlns="aaa"><b xmlns="aaa">4</b><c>44</c></a>') xcol from dual)
      2  select xmltransform(xcol
      3    ,xmltype('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
      4               <xsl:template match="*">
      5                <xsl:element name="{local-name()}" namespace="">
      6                 <xsl:apply-templates select="@* | node()" />
      7                </xsl:element>
      8               </xsl:template>
      9              </xsl:stylesheet>'))
    10  from t;
    XMLTRANSFORM(XCOL,XMLTYPE('<XSL:STYLESHEETVERSION="1.0"XMLNS:XSL="HTTP://WWW.W3.
    <a><b>4</b><c>44</c></a>+but check Laurents Schneider's blog website+
    I didn't find any posts about namespace on Schneider's blog.
    Ants

  • XML namespace to be changed in the outgoing xml message

    HI
    in my scenario I am sending data to a web service .
    The xml namespace that is being sent in t he data is the namespace under which the the object is created.
    while sending the data to the webservice i do not want the ns0: to be attached to the message type and the xml namespace to go as the xml namespace of the vendor.
    Thanks
    Nikhil

    Hi,
    As everyone said you need to remove the namespace in the Message Type screen. If it is a imported XSD you need to remove the attribute targetNamespace.
    After doing this do the mapping once again by selecting the modified message type.
    The above should work... if you are not able to solve it still you can use the following XSLT in the interface mapping after the massage mapping. This is will remove the namespaces and ns0: etc.
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" indent="no"/>
      <xsl:template match="/|comment()|processing-instruction()">
        <xsl:copy>
          <xsl:apply-templates/>
        </xsl:copy>
      </xsl:template>
      <xsl:template match="*">
        <xsl:element name="{local-name()}">
          <xsl:apply-templates select="@*|node()"/>
        </xsl:element>
      </xsl:template>
      <xsl:template match="@*">
        <xsl:attribute name="{local-name()}">
          <xsl:value-of select="."/>
        </xsl:attribute>
      </xsl:template>
    </xsl:stylesheet>

  • Problem using namespace of XML docs gerenrated by  XMLForm

    Hi community!
    I am facing a problem using namespace within a XSL stylsheet. Let me describe my problem:
    I am using the SAP XMLFormsBuilder within the SAP EnterprisePortal in order to provide a HTML based form for creating and editing specific XML documents. The data in the generated documents is finally presented as HTML using XSL Transformation.
    In the XMLFormsBuilder you define the Schema of the XML document and the HTML GUI of the form. The Schema document looks like below (extract):
    <?xml version="1.0" encoding="utf-8"?>
    <schema targetNamespace="http://www.xmlspy.com/schemas/orgchart"
            xmlns="http://www.w3.org/2001/XMLSchema"
            xmlns:xyz="http://www.xmlspy.com/schemas/orgchart" Version="6.3.0">
      <element name="commodity"
               default=""
               minOccurs="1"
               maxOccurs="1"
               ns="p2p"
               xmlns:p2p="http://www.portal.p2p.com">
        <complexType>
          <sequence>
            <element name="administrative_information"
                     default=""
                     minOccurs="1"
                     maxOccurs="1"
                     ns="p2p">
              <complexType>
                <sequence>
                  <element name="creation_date"
                           default=""
                           minOccurs="1"
                           maxOccurs="1"
                           type="date"
                           ns="p2p"/>
    As far as I understand, each element defined in the Schama belongs to the namespace "p2p" and this is exactly what I want.
    The XML document generated by the form looks like below (extract):
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="show_card.xsl"?>
    <commodity xmlns:xf="http://www.sapportals.com/wcm/app/xmlforms"
               xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance"
               xsi:noNamespaceSchemaLocation="/etc/xmlforms/P2PCategoryCard_TEST/P2PCategoryCard_TEST-Schema.xml">
      <administrative_information>
        <creation_date>2005-07-04</creation_date>
    Consequently, the file "show_card.xsl" is the responsible XSLT stylesheet, which looks like this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:p2p="http://www.portal.p2p.com">
      <xsl:output method="html"/>
      <xsl:template match="p2p:commodity">
        <html>
        <body>
          <h2>XSLT Test</h2>
          Creation Date: <xsl:value-of select="p2p:administrative_information/p2p:creation_date"/>
        </body>
        </html>
      </xsl:template>
    </xsl:stylesheet>
    The problem in the XSLT stylesheet is, that I want to access the XML document elements using their namespace. And this is exactly what does not work for me. On the other hand, if I remove the reference to the namespace:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:p2p="http://www.portal.p2p.com">
      <xsl:output method="html"/>
      <xsl:template match="commodity">
        <html>
        <body>
          <h2>XSLT Test</h2>
          Creation Date: <xsl:value-of select="administrative_information/creation_date"/>
        </body>
        </html>
      </xsl:template>
    </xsl:stylesheet>
    the stylesheet works fine, but for some technical reasons, which I don't want to explain here, I have to use the namespace when accessing the XML document elements.
    For technical reasons, I cannot change the format of the Schema document and also cannot change the format of the generated XML document. The only file I can change and control is the XSLT stylsheet.
    My question is now, in the case described above, if there is any way to use the namespace in the sytlesheet when accessing the XML elements?
    Any help is appreciated.
    Cheers,
    Adam Kreuschner

    duggal.ashish wrote:
    3. Some XML files contain a "iso-8859-1" character with character code 146 which appears like apostrophes but actually it is : - &#146; and the problem is that words like can&#146;t are shown as can?t by database.http://en.wikipedia.org/wiki/ISO8859-1
    Scroll down in that page and you'll see that the character code 146 -- which would be 92 in hexadecimal -- is in the "unused" area of ISO8859-1. I don't know where you got the idea that it represents some kind of apostrophe-like character but it doesn't.
    Edit: Actually, I do know where you got that idea. You got it from Windows-1252:
    http://en.wikipedia.org/wiki/Windows-1252
    Not the same charset at all.

  • Issue with XML namespace and Message structure

    Hi All,
    I am using Oracle SOA Suite 11.1.1.4. I have SOA web service application one-way messaging wherein I keep receiving messages from the third party. The issue I am facing is with the XML namespaces which conflicts with the third party's message structure. The details are as below.
    Our Web-service WSDL*
    <schema attributeFormDefault="unqualified" elementFormDefault="qualified"
    targetNamespace="http://amb.com/cad/RealTimeService"
    xmlns:cad="http://amb.com/cad/RealTimeService"
    xmlns:avl="http://schemas.com/asiapac/cad/datamodel/avl/1.0.0"
    xmlns:evn="http://schemas.com/asiapac/cad/datamodel/event/1.0.0"
    xmlns:uni="http://schemas.com/asiapac/cad/datamodel/unit/1.0.0"
    xmlns:dvt="http://schemas.com/asiapac/cad/datamodel/divert/1.0.0"
    xmlns:sui="http://schemas.com/asiapac/cad/datamodel/suppinfo/1.0.0"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <import namespace="http://schemas.com/cad/datamodel/avl/1.0.0"
    schemaLocation="AvlCadSchema.xsd"/>
    <import namespace="http://schemas.com/cad/datamodel/unit/1.0.0"
    schemaLocation="UnitCadSchema.xsd"/>
    <import namespace="http://schemas.com/cad/datamodel/event/1.0.0"
    schemaLocation="EventCadSchema.xsd"/>
    <import namespace="http://schemas.com/cad/datamodel/divert/1.0.0"
    schemaLocation="HewsCadSchema.xsd"/>
    <import namespace="http://schemas.com/cad/datamodel/suppinfo/1.0.0"
    schemaLocation="SupplementalInformationCadSchema.xsd"/>
    <element name="AvlAuxData" type="avl:AvlAuxData" nillable="true"/>
    <element name="AgencyEvent" type="evn:AgencyEvent"/>
    <element name="Diversion" type="dvt:HospitalDiversionMessage"/>
    <element name="SupplementalInformation" type="sui:SupplementalInformation"/>
    <element name="UnitDetail" type="uni:UnitDetail"/>
    </schema>
    Using SOAP UI tool a HospitalDiversionMessage Request for the above WSDL will look like*
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:real="http://amb.com/cad/RealTimeService" xmlns:ns="http://schemas.com/cad/datamodel/divert/1.0.0">
    <soapenv:Header/>
    <soapenv:Body>
    <*real*:Diversion>
    <ns:Action>?</ns:Action>
    <ns:Open>?</ns:Open>
    <!--Optional:-->
    <ns:Location>?</ns:Location>
    <ns:Type>?</ns:Type>
    <ns:SubType>?</ns:SubType>
    <!--Optional:-->
    <ns:ExpiryTimestamp>?</ns:ExpiryTimestamp>
    <!--Optional:-->
    <ns:Comment>?</ns:Comment>
    <!--Optional:-->
    <ns:ItemNumber>?</ns:ItemNumber>
    <!--Optional:-->
    <ns:Notifications>?</ns:Notifications>
    <ns:CreatedTerminal>?</ns:CreatedTerminal>
    <ns:CreatedTimestamp>?</ns:CreatedTimestamp>
    <!--Optional:-->
    <ns:ClosedBy>?</ns:ClosedBy>
    <!--Optional:-->
    <ns:ClosedComments>?</ns:ClosedComments>
    <!--Optional:-->
    <ns:ClosedTerminal>?</ns:ClosedTerminal>
    <!--Optional:-->
    <ns:ClosedTimestamp>?</ns:ClosedTimestamp>
    </real:Diversion>
    </soapenv:Body>
    </soapenv:Envelope>
    Now the third party sends a HospitalDiversionMessage in this format_
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://amb.com/cad/RealTimeService" xmlns:ns="http://schemas.com/cad/datamodel/divert/1.0.0">
    <soapenv:Header/>
    <soapenv:Body>
    <ns0:Diversion>
    <ns0:Action>?</ns0:Action>
    <ns0:Open>?</ns0:Open>
    <!--Optional:-->
    <ns0:Location>?</ns0:Location>
    <ns0:Type>?</ns0:Type>
    <ns0:SubType>?</ns0:SubType>
    <!--Optional:-->
    <ns0:ExpiryTimestamp>?</ns0:ExpiryTimestamp>
    <!--Optional:-->
    <ns0:Comment>?</ns0:Comment>
    <!--Optional:-->
    <ns0:ItemNumber>?</ns0:ItemNumber>
    <!--Optional:-->
    <ns0:Notifications>?</ns0:Notifications>
    <ns0:CreatedTerminal>?</ns0:CreatedTerminal>
    <ns0:CreatedTimestamp>?</ns0:CreatedTimestamp>
    <!--Optional:-->
    <ns0:ClosedBy>?</ns0:ClosedBy>
    <!--Optional:-->
    <ns0:ClosedComments>?</ns0:ClosedComments>
    <!--Optional:-->
    <ns0:ClosedTerminal>?</ns0:ClosedTerminal>
    <!--Optional:-->
    <ns0:ClosedTimestamp>?</ns0:ClosedTimestamp>
    </ns0:Diversion>
    </soapenv:Body>
    </soapenv:Envelope>
    Questions*
    1) I cannot figure out how the SOAPUI tool or SOA substitutes "real" as the namespace prefix for the WSDL based HospitalDiversionMessage and what I need to do at my end to match the message structure as per what the third party needs.
    2) I need ns0 namespace prefix to whole of Diversion xml element. Currently it is "real" at top Diversion element and "ns" for its children
    Please suggest, I can attach the other imported XSD if need be.
    Thanks
    Edited by: user5108636 on Jun 13, 2011 6:55 PM
    Edited by: user5108636 on Jun 13, 2011 6:57 PM
    Edited by: user5108636 on Jun 13, 2011 7:02 PM

    Questions
    1) I cannot figure out how the SOAPUI tool or SOA substitutes "real" as the namespace prefix for the WSDL based HospitalDiversionMessage and what I need to do at my end to match the message structure as per what the third party needs.The xml namespace suffixes like real and ns0 are just references used by the XML Parsers. For that matter the "real" can be xyz as well.
    You dont need to make any changes as long as the xml namespace suffixes refer to the same namespace.
    If you see the first soapUI xml and the third party xml have the same namespace references and hence it is not a problem:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:real="*http://amb.com/cad/RealTimeService*" xmlns:ns="http://schemas.com/cad/datamodel/divert/1.0.0">
    <soapenv:Header/>
    <soapenv:Body>
    <*real*:Diversion>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="*http://amb.com/cad/RealTimeService*" xmlns:ns="http://schemas.com/cad/datamodel/divert/1.0.0">
    <soapenv:Header/>
    <soapenv:Body>
    <*ns0*:Diversion>
    2) I need ns0 namespace prefix to whole of Diversion xml element. Currently it is "real" at top Diversion element and "ns" for its childrenBased on this, logically both the xmls represent the same xml message. And hence you dont need to make any changes.
    Please refer to the basics of xml namespaces using the following links:
    http://en.wikipedia.org/wiki/XML_namespace
    http://zvon.org/comp/r/tut-Namespace.html#Pages~Introduction
    Let us know if you still need clarification.
    Hope this helps.
    Thanks,
    Patrick

  • Idoc to XML, namespace is not getting created in output XML

    Hi All
    My interface is idoc to XML.
    I am using graphical message mapping.
    In output xml , namespace is not  formed
    Can any one tell why namespace is not  created in the XML and
    How to add the  namespace to the  output XML .
    Kindly help
    Regards,
    Sheela

    Hi,
    You can change your external definition to achieve it.  just compare the structure of your xsd with some other normal data type xsd and change accordingly.
    Inder

  • How to change the input variable xml structure before invoking an ext. serv

    Hi all;
    I have a bpel. in my bpel i have an invoke activity which calls an external webservice. I call my bpel with the input below.
    *<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">*
    *<SOAP-ENV:Body>*
    *<requestCustomerAccountBalance xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">*
    *<header xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">*
    *<application xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">CSI</application>*
    *<operationDate xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">03/14/2011 14:51:37</operationDate>*
    *<operationName xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">CSI</operationName>*
    *<transactionId xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">3424342</transactionId>*
    *<userId xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">tuba</userId>*
    *</header>*
    *<msisdn xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">5356474828</msisdn>*
    *<applicationName xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">CSI</applicationName>*
    *<channel xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">CSI</channel>*
    *<clientTimeStamp xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">03/14/2011 14:51:37</clientTimeStamp>*
    *<transactionId xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">3424342</transactionId>*
    *<accountType xmlns="http://impl.ejb.service.almanak.baca.turkcelltech.com/">ACC</accountType>*
    *</requestCustomerAccountBalance>*
    *</SOAP-ENV:Body>*
    *</SOAP-ENV:Envelope>*
    Before invoking the ext. service i want to change the input as follows.
    *<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:impl="http://impl.ejb.service.almanak.baca.turkcelltech.com/">*
    *<soapenv:Header/>*
    *<soapenv:Body>*
    *<impl:requestCustomerAccountBalance>*
    *<!--Optional:-->*
    *<header>*
    *<!--Optional:-->*
    *<application>?</application>*
    *<!--Optional:-->*
    *<operationDate>?</operationDate>*
    *<!--Optional:-->*
    *<operationName>?</operationName>*
    *<!--Optional:-->*
    *<transactionId>?</transactionId>*
    *<!--Optional:-->*
    *<userId>?</userId>*
    *</header>*
    *<!--Optional:-->*
    *<msisdn>5356474828</msisdn>*
    *<!--Optional:-->*
    *<applicationName>CSI</applicationName>*
    *<!--Optional:-->*
    *<channel>CSI</channel>*
    *<!--Optional:-->*
    *<clientTimeStamp>20101010</clientTimeStamp>*
    *<!--Optional:-->*
    *<transactionId>676767</transactionId>*
    *<!--Optional:-->*
    *<accountType>ACC</accountType>*
    *</impl:requestCustomerAccountBalance>*
    *</soapenv:Body>*
    *</soapenv:Envelope>*
    HOW TO ACHIEVE THIS.???
    Any comment would be appreciated.
    Best Regards

    You can go through the below thread for removing the namespce
    Removing namespace from xml  created
    http://beatechnologies.wordpress.com/2008/09/25/stripping-namespace-from-an-xml-using-xquery/
    Edited by: 333333 on Mar 17, 2011 6:44 PM
    Edited by: 333333 on Mar 17, 2011 6:45 PM

  • Problem due to Namespace in XML

    Hi,
    From XI (Outbound proxy from R/3), using an XML package I am calling a webservice of a 3rd party system to create a contract. The webservice is failing. The 3rd party system is saying that it is failing becuase of the additonal lines in XML (like namespace details and hypens in the XML). Please see the below XML message that is displayed in Payload in SXMB_MONI.
    <?xml version="1.0" encoding="UTF-8" ?>
    <b>-</b> <<b>ns0:MT_SM_Contract xmlns:ns0="http://test.com/xi/sm"></b>
    <b>-</b> <CONTRACTS>
    <b>-</b> <Control>
      <createdWhen>2006-06-09T06:09:52</createdWhen>
      <destinationAddress />
      <documentGUID>495f31bc-9f99-4e56-9db7-ce5dc7095785</documentGUID>
      <operation staticValue="Change" />
      <schemaVersion>31N</schemaVersion>
      <sourceAddress>Global</sourceAddress>
      <version>3.00</version>
      </Control>
    Is it possible to remove the namespace details and Hypens in XI before calling the Webservice.
    Thanks
    Sri

    Kumar,
    While defining MT, delete the name space that is automatically read in XML NameSpace field.
    Go to Q no 12 in the following link:
    /people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions
    -Naveen.

  • 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.

  • Javax.servlet.ServletException: The name "" is not legal for JDOM/XML namespaces

    Dear all,
    First of all sorry, if this is not the right place for my question.
    I am facing some problem with the XFire Webservices. When i am trying to access the WSDL through the url. server is throwing the following exception :
    javax.servlet.ServletException: The name "" is not legal for JDOM/XML namespaces: Namespace URIs must be non-null and non-empty Strings.
         org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:143)
         org.codehaus.xfire.transport.http.XFireServlet.doGet(XFireServlet.java:107)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    root cause
    org.jdom.IllegalNameException: The name "" is not legal for JDOM/XML namespaces: Namespace URIs must be non-null and non-empty Strings.
         org.jdom.Namespace.getNamespace(Namespace.java:164)
         org.codehaus.xfire.util.NamespaceHelper.getUniquePrefix(NamespaceHelper.java:58)
         org.codehaus.xfire.aegis.type.basic.BeanType.writeSchema(BeanType.java:560)
         org.codehaus.xfire.wsdl.AbstractWSDL.addDependency(AbstractWSDL.java:224)
         org.codehaus.xfire.wsdl.AbstractWSDL.addDependency(AbstractWSDL.java:233)
         org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createDocLitPart(WSDLBuilder.java:403)
         org.codehaus.xfire.wsdl11.builder.WSDLBuilder.createPart(WSDLBuilder.java:355)
         org.codehaus.xfire.wsdl11.builder.WSDLBuilder.writeParameters(WSDLBuilder.java:509)
    cont.......
    I am not able to figure out the root cause for this. The service.xml file looks like below:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- START Service.xml -->
    <beans xmlns="http://xfire.codehaus.org/config/1.0">
    <!-- Construct the castor service factory by Spring -->
    <bean id="castorTypeRegistry" class="org.codehaus.xfire.castor.CastorTypeMappingRegistry"/>
    <bean id="bindingProvider" class="org.codehaus.xfire.aegis.AegisBindingProvider">
    <constructor-arg ref="castorTypeRegistry"/>
    </bean>
    <bean id="castorServiceFactory" class="org.codehaus.xfire.service.binding.ObjectServiceFactory">
    <constructor-arg index="0" ref="xfire.transportManager"/>
    <constructor-arg index="1" ref="bindingProvider"/>
    </bean>
    <service>
    <name>ReleaseManager</name>
    <namespace>ReleaseManager</namespace>
    <serviceClass>com.pinkroccade.jfoundation.calculation.releases.ReleaseManager</serviceClass>
    <implementationClass>com.pinkroccade.jfoundation.calculation.releases.ReleaseManagerImpl</implementationClass>
    <schemas>
    <schema>META-INF/schema/release-impact-worksheet-3.2.0.xsd</schema>
    </schemas>
    <style>document</style>
    <serviceFactory>#castorServiceFactory</serviceFactory>
    </service>
    </beans>
    <!-- END Service.xml-->
    The issue which i am facing is it due to the problem with the service.xml (Which i dont think so..), Or is it any thing to do with the XSD file which i am using.
    Can any body give me some guide lines for this ????
    Thanks in advance.
    Thanks and Regards,
    Manjunath.

    Any one any thoughts..
    I need to find out the solution for this as soon as possible; Not able to proceed further...
    Thanks and Regards,
    Manjunath.

  • Change MessageType name in xml file

    Hi experts,
    I have developed a receiver interface that creates an xml file and put it on an external server.
    Now other side says that this tag:
    <ns0:MT_MexElectronicInvoice_EDICOM xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice">
    is not correct, they want another description:
    <ns0:MT_MexElectronicInvoice_myFirm xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice">
    My question is: is possible to change MessageType tag in xml file without changing the message type structure name in Integration Repository?
    thanks
    fabio

    use another mapping which has the target  MT as  <ns0:MT_MexElectronicInvoice_myFirm xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice">
    Add this mapping after the original mapping in your interface/operation mapping.
    This will be the easiest way to handle this requirement as you will only need to do a one to one mapping.
    Another option will be to write a java mapping to do a simple replace function for the string <ns0:MT_MexElectronicInvoice_EDICOM xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice"> to  <ns0:MT_MexElectronicInvoice_myFirm xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice">

  • How to remove element namespaces in XML file using DOM or SAX?

    Hi Guys,
    I developed a JAVA mapping in XI to add name spaces for XML file, after mapping,name spaces xmlns="http://www.mro.com/mx/integration" and xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" were added correctly, but for some nodes, such as <Header> and <Content>, a name space xmlns="" was added automatically.Please check below files to compare.
    It looks like be added automatically by XI. I didn't process anything for these nodes in JAVA program.
    Now the issue is, how can I remove these redundant namespaces? Such as xmlns="".
    Can I remove them using DOM or SAX in JAVA Mapping?
    Thanks in advance.
    ====>Original XML file
    <?xml version="1.0" encoding="UTF-8"?>
    <LLYLPPInterface language="EN">
       <Header>
          <SenderID>GBIP</SenderID>
          <CreationDateTime>2008-02-13T22:49:34-05:00</CreationDateTime>
          <RecipientID/>
          <MessageID/>
       </Header>
       <Content>
          <LLY-LPP>
             <INVOICE>
                <INVOICELINE>
                   <PONUM>4780000008</PONUM>
                   <POLINENUM>1</POLINENUM>
                   <INVOICEQTY>1</INVOICEQTY>
                   <LOADEDCOST>68</LOADEDCOST>
                </INVOICELINE>
             </INVOICE>
          </LLY-LPP>
       </Content>
    </LLYLPPInterface>
    ===>Target XML file after JAVA mapping
    <?xml version="1.0" encoding="utf-8"?>
    <LLYLPPInterface language="EN" xmlns="http://www.mro.com/mx/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Header xmlns="">
              <SenderID>GBIP</SenderID>
              <CreationDateTime>2008-02-13T23:11:55-05:00</CreationDateTime>
              <RecipientID/>
              <MessageID/>
         </Header>
         <Content xmlns="">
              <LLY-LPP>
                   <INVOICE>
                        <INVOICELINE>
                             <PONUM>4780000008</PONUM>
                             <POLINENUM>0</POLINENUM>
                             <INVOICEQTY>1</INVOICEQTY>
                             <LOADEDCOST>68</LOADEDCOST>
                        </INVOICELINE>
                   </INVOICE>
              </LLY-LPP>
         </Content>
    </LLYLPPInterface>
    Edited by: Eddie Zhang on Feb 14, 2008 9:22 AM
    Edited by: Eddie Zhang on Feb 14, 2008 9:24 AM

    Hi Milan,
    Thanks for your replay.
    Actually when I used module XMLAnonymizerBean to convert namespaces, the header of XML, such as <?xml version="1.0" encoding="UTF-8"?> was converted to format <?xml version='1.0' encoding='UTF-8'?>, quote was converted to single quote. Although I set parameter anonymizer.quote = ", it still didn't work, single quote appeared instead of quote.
    I'm not sure why this happened. Can anyone help to clarify this?
    Thanks
    Edited by: Eddie Zhang on Feb 15, 2008 2:11 AM

  • Remove  Namespace from XML File except Attribute

    Hi  XI  Experts ,
    1.I have referred to the code of xslt Generic XSLT Code to Remove ALL Namespaces from XML:
    http://forums.sdn.sap.com/thread.jspa?threadID=1920630
    But this removes the Attribute : id  from the records .
    My expected output is supposed to be :
    <?xml version="1.0" encoding="GBK"?>
    <body>
      <head>
        <nsrsbh>112001069711</nsrsbh>
        <nsrmc>诺维信(中国)生物技术有限公司出口发票</nsrmc>
        <dcrq>20120209</dcrq>
        <sssq_q>20111201</sssq_q>
        <sssq_z>20120207</sssq_z>
        <records>4</records>
      </head>
      <data>
        <record id="1">
           <fpdm></fpdm>
        </record>
    </data>
    </body
    But after using this XSLT code it removes :id from <record_1 id=> and generated the below code :
    The xml file now doesn't contain teh attribute :id
    <?xml version="1.0" encoding="GBK"?>
    <body>
      <head>
        <nsrsbh>112001069711</nsrsbh>
        <nsrmc>诺维信(中国)生物技术有限公司出口发票</nsrmc>
        <dcrq>20120209</dcrq>
        <sssq_q>20111201</sssq_q>
        <sssq_z>20120207</sssq_z>
        <records>4</records>
      </head>
      <data>
        <record>
          1
          <fpdm></fpdm>          
           </record>
    </data>
    </body>
    Could  you please provide your input
    Plaese note : Here  XI versin iS x1 3.0 SP7 . I have tried suing the Analyzer bean for the Encoing  of Chinese : GBK Intsead of UTF-8 in the Namespace  . But AF_Modules/XMLAnonymizerBean is not comptacible with XI 3.0 SP7
    Hence i have used the following code to remove namespcae and add  Encoding :GBK instead of UTF-8:
    <?xml version="1.0" ?>
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output encoding="GBK"/>
    <xsl:template match="node()|@*">
      <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
    </xsl:template>
    </xsl:stylesheet>

    You could use exclude-result-prefixes.
    For example:
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wt="http://www.example.com" exclude-result-prefixes="wt">
    </xsl:stylesheet>

  • How to remove prefix namespace in Xml from XmlBean

    I am trying to generate XML from XML Bean but i am getting namespace prefix in all my xml elements.
    For example
    <abc:Cutomer xmlns:abc="http://www.xyz.com/pqr>
    <abc:Name>
    I don't have this namespace prefix in my XSD (imported in Weblogic workshop).
    Is there any way that I can remove this prefix from my xml elements?
    Also, I don't need xml namespace in my xml string.
    Is there any way that I can generate xml without having namespace?

    Hello ,
    I think this issue as been discussed earlier in this forum. Refer follwoing link..
    http://forums.bea.com/bea/message.jspa?messageID=400000090#400000090
    Regards,
    Kuldeep Singh.

Maybe you are looking for