cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove prefix "ns1" from XML tag

Former Member
0 Kudos

Dear all,

I have a message BMP to File and i am using External Definitions .XSD and .WSDL files.

The payload I am sending to an HTTP site looks like this :

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

- <ns1:Order xmlns:ns1="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd">

- <ns1:OrderHeader>

- <ns1:OrderNumber>

<ns1:BuyerOrderNumber>2000032962</ns1:BuyerOrderNumber>

</ns1:OrderNumber>

<ns1:OrderIssueDate>2005-10-18</ns1:OrderIssueDate>

</ns1:OrderHeader>

</ns1:Order>

But I need a XLM without namespace prefix like this:

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

- <Order xmlns:ns1="rrn:org.xcbl:schemas/xcbl/v3_5/xcbl35.xsd">

- <OrderHeader>

- <OrderNumber>

<:BuyerOrderNumber>2000032962</ns1:BuyerOrderNumber>

<OrderNumber>

<OrderIssueDate>2005-10-18</ns1:OrderIssueDate>

<OrderHeader>

<Order>

How can I do this,

Thank's.

Fernando

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

Technically the XML messages are the same with or without namespace prefixes. So there should not be any problem at the receiver site.

If the receiver does not accept namespace prefix at all, you can eliminate them with the XMLAnonymizerBean.

/people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean

If you have not upgraded to SP14 (XI 3.0) so far, you need to write an own Java mapping or adapter module or XSLT mapping to get rid of the prefixes.

Regards

Stefan

Former Member
0 Kudos

Hi,

I can not use XMLAnonymizerBean because I am using a sender soap adapter.

Do you know how to write a Java Mapping or XLST mapping to get rid of the prefixes?

Thank's a lot for your help.

Fernando

Message was edited by:

Consultor Geral CSCorp

prabhu_s2
Active Contributor
0 Kudos

check this thread:

Former Member
0 Kudos

Hi,

>>>I can not use XMLAnonymizerBean because I am using a sender soap adapter<<<

I thought you can use adapter modules in any adapter....please correct me if i am wrong....

Just see the details of how to use the Anonymizer bean in the OSS note - 880173.

Thanks,

Renjith

stefan_grube
Active Contributor
0 Kudos

Hi Fernando,

When you have inbound messages and you have also WSDL and XSD, is it not possible to use the xsd for mapping? In the graphical mapping tool yo can add the xsd assource instead of a message type.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan

I used XMLAnonymizerBean of the right way and worked fine. (BPM -> File).

Thank's a lot.

No, I need to use XMLAnonymizerBean also with sender soap adapter. But in your blog you say: <i>"Note: It is not possible to use this module in the sender SOAP adapter as this adapter type does not support any additional modules."</i>

But Renjith comments above:

<i>"I thought you can use adapter modules in any adapter"</i>

Can we user XMLAnonymizerBean to sender SOAP adapter?

Best regards,

Fernando

Former Member
0 Kudos

HI Fernando,

That was my unerstanding, only after seeing your reply did i check stefan's blog....

since he has particularly noted that the additional adapter modules cannot be used in SOAP sender channel..it must be right...

Thanks,

Renjith

Note : it was totally my mistake

and stefan is correct...please check the help link and it clearly says that we cannot use additional adapter modules for soap sender adapter...

http://help.sap.com/saphelp_nw04/helpdata/en/fc/5ad93f130f9215e10000000a155106/frameset.htm

Message was edited by:

Renjith Andrews

Answers (4)

Answers (4)

paul_digance
Explorer
0 Kudos

Hi Fernando,

You can remove the namespace prefixes using an XSLT mapping if they are causing problems with applications outside of XI.

Try the following code:

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

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns="http://www.arconw.com/XI/XSLT_Library/XmlNamespacePrefixRemoval"

version="1.0">

<xsl:output method = "xml" />

<xsl:template match="/">

<xsl:apply-templates select="*" mode="remprefix"/>

</xsl:template>

<xsl:template match="*" mode="remprefix">

<xsl:variable name="newname" select="local-name(.)"/>

<xsl:element name="{$newname}" namespace ="{namespace-uri()}">

<xsl:apply-templates mode="copyall" select="@*|comment()|processing-instruction()|text()"/>

<xsl:apply-templates select="*" mode="remprefix"/>

</xsl:element>

</xsl:template>

<xsl:template mode="copyall" match="@*|comment()|processing-instruction()|text()">

<xsl:copy>

<xsl:apply-templates mode="copyall" select="@*|comment()|processing-instruction()|text()"/>

</xsl:copy>

</xsl:template>

</xsl:stylesheet>

      • Please assign forum points if you find this useful ***

Thanks,

Paul D.

Message was edited by:

Paul Digance

Former Member
0 Kudos

remove the namespace in our Message Type

Regards

Sreeram.G.Reddy

Former Member
0 Kudos

Hi Fernando,

see you have .XSD files.....open your .XSD file in notepad..........here you will see your namespaces.......remove namespaces where you dont want.....save your .XSD files.....then in External defintiotn import this last file......then your namespaces will be removed....

Thanks,

Rajeev Gupta

Message was edited by:

RAJEEV GUPTA

MichalKrawczyk
Active Contributor
0 Kudos

hi,

check question:

12. I have a problem with namespaces in XI - Is there a way to remove them?

on the XI FAQ page

but this will only work if you work with data types (and message types)

Regards,

michal

-


<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

Former Member
0 Kudos

Hi,

The problem is that I am not using a message type.

I am using a External Definition with a .XSD file.

Thank's a lot for your help.]

Fernando

Former Member
0 Kudos

then edit our in XSD.