on 03-28-2012 12:23 PM
Hi All,
I have a scenario where i need to remove the name-space from XML file.
I have an existing scenario where the output of xml file is as shown below.
<?xml version="1.0" encoding="UTF-8" ?>
<ns0:abc xmlns:ns0="xyz">
</ns0:abc>
but my output file is as
<?xml version="1.0" encoding="utf-8" ?>
<123>000000000000</123>
<345>2011</345>
<567>0</567>
</Data>
</ns1:abc>
So how to remove namespace http://www.w3.org/2001/XMLSchema-instance from XML file.
i have configured the CC the same way as the existing CC but this name space is appearing in XML file
why is it so?
Hi Sai,
Most probably your target structure definition has been downloaded as an external definition, having this namespace http://www.w3.org/2001/XMLSchema-instance already included, am I right?
Anyway, you do not have to worry about that, simply use the XML Anonymizer Bean to remove that namespace from the XML file. Use module name: AF_Modules/XMLAnonymizerBean and one additional parameter anonymizer.acceptNamespaces with value xyz ns0, as the anonymizer bean removes namespaces that are NOT included here. See more details here if required:
http://help.sap.com/saphelp_nw04/helpdata/en/45/d169186a29570ae10000000a114a6b/content.htm
Also a nice example with screenshots here:
http://www.saptechnical.com/Tutorials/XI/XMLPayload/Index.htm
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> So how to remove namespace http://www.w3.org/2001/XMLSchema-instance from XML file.
If you want to remove namespace or namespace prefixes you can use XMLAnonymizerBean module. If you want to add namespace then one of the possible way is to use XSLT mapping or Java mapping.
In the above example ns1 or xsi is the namespace prefix.
Please refer sap help document for XMLAnonymizerBean
Message was edited by: Baskar Gopalakrishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
pls check the msg types of the 2 scenarios and see XML namespaces mentioned there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can remove the XML namespaces from the message types so that this wont appear in the xml output.
-Deepak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you try to concatenate a XSL mapping?
Remove all namespaces
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" />
<xsl:template match="*">
<xsl:element name="{local-name()}" >
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Remove all except the namespace xyz
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" />
<xsl:template match="*">
<xsl:element name="{local-name()}" namespace="xyz">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.