Skip to Content
0
Former Member
Jan 23, 2013 at 09:56 PM

Invalid character in xml transformation output file

240 Views

While creating xml file using xml transformation(STRANS) I am getting illegal character for which our customer is not able to process the file in their system.

Following is the code for transforming internal table using STRANS.

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns:asx="http://www.sap.com/abapxml" exclude-result-prefixes="asx" version="1.0">

<xsl:output indent="no"/>

<xsl:strip-space elements="*"/>

<xsl:template match="/asx:abap/asx:values/CONFIRM">

<Order xmlns="urn:carrier:names:specification:ubl:schema:xsd:CarrierPOResponse-2.0" xmlns:cac="urn:oasis:names:draft:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:draft:ubl:schema:xsd:CommonBasicComponents-2" xmlns:xsi=

"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:carrier:names:specification:ubl:schema:xsd:CarrierPOResponse-2.0 ../../src/xsd/runtime/maindoc/UBL-&#xA;CarrierPOResponse-2.0.xsd">

<xsl:for-each select="*">

<xsl:if test="ID !=''">

<cbc:ID>

<xsl:value-of select="ID"/>

</cbc:ID>

<cbc:CopyIndicator>

<xsl:value-of select="COPYINDICATOR"/>

</cbc:CopyIndicator>

</xsl:if>

</xsl:for-each>

and xml output of the file is:

<?xml version="1.0" encoding="utf-8"?><Order xmlns="urn:carrier:names:specification:ubl:schema:xsd:CarrierPOResponse-2.0" xmlns:cac="urn:oasis:names:draft:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:draft:ubl:schema:xsd:CommonBasicComponents-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:carrier:names:specification:ubl:schema:xsd:CarrierPOResponse-2.0 ../../src/xsd/runtime/maindoc/UBL-CarrierPOResponse-

In the output file there is special character between encoding="utf-8"?>and<Order xmlns=" ( see the first line of output file, and position 38) which is causing issue in reading the file in our customer's system.

Please help me to get rid of this special character from the xml output file. Let me know if you need any more information. We are using SAP ECC 6.0.


Attachments