on 08-19-2008 9:16 AM
Hi,
Does anyone know how to add a comment line in outgoing XML message from XI? Using graphical mapping or java or adapter module?
Something like .....
<?xml version='1.0' encoding='UTF-8' ?>
<! this is a comment>
<record>
Thanks
Pushpinder
You can write below statement in simple java mapping
As you want to insert comment before <record>
read entire source structure in string strXMLSource
finalString = strXMLSource.replaceAll("<record>", "<!-- this is a comment--><record>");
in out.write statement pass finalString....
No need to write any parser, just write simple code in execute method
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can transform your XML with an XSLT transformation:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="utf-8" indent="no" method="xml" version="1.0"/>
<xsl:param name="COMMENT"/>
<xsl:preserve-space elements="*"/>
<xsl:template match="/">
<xsl:comment>
<xsl:value-of select="$COMMENT"/>
</xsl:comment>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:transform>
Best wishes,
Jan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Some more complications in the requirement
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pushpinder,
depends on the kind of mapping you process:
1) graphical mapping: not possible
2) xsl-mapping: use <xsl:comment>
3) JAVA-Mapping: Insert a comment-node to the target structure
3) ABAP-Mapping: Insert a comment-node to the target structure
Regards Mario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have to add a comment line in the target xml like:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE RMS_MODEL SYSTEM 'RMS_Model.dtd'>
<RMS_MODEL>
<DIVISION Value="2"/>
<RMS_RANGE Value="0801"/>
<WORKING_NO Value="S8153219"/>
<MODEL_NO/>
<MODEL_NAME/>
<CARRY_OVER/>
i am able to achieve the above.
But in my message mapping I am using multi mapping, so after the message mapping the target structure looks something like:
<?xml version='1.0' encoding='UTF-8' ?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge"><ns0:Message1>
<!DOCTYPE RMS_MODEL SYSTEM 'RMS_Model.dtd'>
<RMS_MODEL>
<DIVISION Value="2"/>
<RMS_RANGE Value="0801"/>
<WORKING_NO Value="S8153219"/>
<MODEL_NO/>
<MODEL_NAME/>
<CARRY_OVER/>
now, is it possible to add a comment line as shown in this example?Or is it preferable to use an adapter module?
Thanks
Pushpinder
Comment for xml should be inserted
<!-- Your Comment -->
Thanks
Sunil Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
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.