cancel
Showing results for 
Search instead for 
Did you mean: 

Adding extra namespace in the target structure

Former Member
0 Kudos

Input file (currently generating from existing message mapping)

********************************************************

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

<pData xmlns:xsi="namespace1">

<Name>name</Name>

<ListChange>

<status>Active</status>

</ListChange>

</pData>

********************************************************

Required File

********************************************************

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

<pData xmlns:xsi="namespace1" xmlns="namespace2">

<Name>name</Name>

<ListChange>

<status>Active</status>

</ListChange>

</pData>

********************************************************

To add the extra namespace (xmlns="namespace2") used following ways.

1. Using XML Anonymiser bean module

Still the no change in the output (only accepting one namespace at a time 1/2)

2. Using XSLT Mapping as 1st row in interface mapping

********************************************************

<?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" encoding="UTF-8"/>

<xsl:template match="/pData">

<pData xmlns:xsi="namespace1" xmlns="namespace2">

<xsl:copy-of select="/pData/Name"/>

<xsl:copy-of select="/pData/ListChange/status"/>

</pData>

</xsl:template>

</xsl:stylesheet>

********************************************************

We are getting the following error

com.sap.aii.utilxi.misc.api.BaseRuntimeException; Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 65, 73(:main:, row:8851, col:24)

Any inputs are welcome.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

As problem still exists

Shabarish_Nair
Active Contributor
0 Kudos

>

> Input file (currently generating from existing message mapping)

>

> ********************************************************

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

>

> <pData xmlns:xsi="namespace1">

>

> <Name>name</Name>

> <ListChange>

> <status>Active</status>

> </ListChange>

>

> </pData>

> ********************************************************

> Required File

> ********************************************************

>

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

>

> <pData xmlns:xsi="namespace1" xmlns="namespace2">

>

> <Name>name</Name>

> <ListChange>

> <status>Active</status>

> </ListChange>

>

> </pData>

> ********************************************************

>

> To add the extra namespace (xmlns="namespace2") used following ways.

> 1. Using XML Anonymiser bean module

> Still the no change in the output (only accepting one namespace at a time 1/2)

the bean is to remove namespaces.. not to add

> 2. Using XSLT Mapping as 1st row in interface mapping

> ********************************************************

>

> <?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" encoding="UTF-8"/>

>

> <xsl:template match="/pData">

>

> <pData xmlns:xsi="namespace1" xmlns="namespace2">

> <xsl:copy-of select="/pData/Name"/>

> <xsl:copy-of select="/pData/ListChange/status"/>

>

> </pData>

>

> </xsl:template>

> </xsl:stylesheet>

> ********************************************************

> We are getting the following error

> com.sap.aii.utilxi.misc.api.BaseRuntimeException; Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 54, 65, 73(:main:, row:8851, col:24)

>

> Any inputs are welcome.

the code looks fine. but i prefer a simple java mapping with a string operation to replace the tag <pData xmlns:xsi="namespace1"> to <pData xmlns:xsi="namespace1" xmlns="namespace2">. it will be simple string handling plus you will not lose any performance by using a XSLT parser invoked.

former_member200962
Active Contributor
0 Kudos

I tried your XSLT code in an online editor and did not find any error....got the output as nameActive.

I hope that your first statement (XML declaration) is proper:

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

The above has an extra \ at the end....i hope that it is not a typo...correct declaration will be:

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

Regards,

Abhishek.

Former Member
0 Kudos

Hi Abhishek,

I have checked but in my original code an extra \ at the end is not exists... but still I am getting the following error.

com.sap.aii.utilxi.misc.api.BaseRuntimeException; Fatal Error:

> com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data

> allowed here: (hex) 54, 65, 73(:main:, row:8851, col:24)

Is there any other settings need to be done befoe calling in the Interface mapping?

former_member208856
Active Contributor
0 Kudos

In your message type (MT), there is one option for XML Namespace, try to give extra name space there.

I hope it will work.

former_member200962
Active Contributor
0 Kudos

If you try to execute the XSLT mapping in some XSLT tool (like STYLUS) does it execute properly? I hope that there is no mismatch between the source and target structures of the XSLT mapping and that of the Interface Mapping....verify this again.

Other than importing the XSLT mapping into IR there is no other setting to be done.

You have marked the question as Answered!

Regards,

Abhishek.

Former Member
0 Kudos

Hi Sandeep,

I have used XML Namespace as well but there is no change in target file neither error.

Thanks

Jayashri

Former Member
0 Kudos

Hi Abhishek,

I have again created new scenario

Input file (currently generating from existing message mapping)

********************************************************

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

<ns0:pData xmlns:ns0="namespace1">

<Name>name</Name>

<ListChange>

<status>Active</status>

</ListChange>

</ns0:pData>

********************************************************

Required File

********************************************************

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

<ns0:pData xmlns:xsi="namespace2" xmlns:ns0="namespace1">

<Name>name</Name>

<ListChange>

<status>Active</status>

</ListChange>

</ns0:pData>

********************************************************

XSL used

********************************************************

<?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" encoding="UTF-8"/>

<xsl:template match="/ns0:pData">

<ns0:pData xmlns:xsi="namespace2" xmlns:ns0="namespace1">

<xsl:copy-of select="/ ns0:pData/Name"/>

<xsl:copy-of select="/ ns0:pData/ListChange/status"/>

</ ns0:pData>

</xsl:template>

</xsl:stylesheet>

********************************************************

I have checked the input file & XSL in XSLT editoru2026. I am getting the proper result like nameActiveu2026 if I upload same fileu2026 I am getting the following error.

*Error when loading XSLT mapping of the application*

*Transformer configuration exception occurred*

*com.sap.engine.lib.xml.util.NestedException: Prefix not mapped: ns0 -> java.lang.Exception: XMLParser: Prefix 'ns0' is not mapped to a namespace at com.sap.engine.lib.xsl.xpath.ETBuilder.getQName_int*

Any suggestion?

Former Member
0 Kudos

Hi,

In stylesheet you need to add the namespace.

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

<xsl:stylesheet version="1.0"

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

xmlns:ns0="namespace1"

>

Regards,

Prakasu.M

VijayKonam
Active Contributor
0 Kudos

Could you paste the output of your XSLT mapping here?

VJ

Former Member
0 Kudos

Hi Vijayashankar,

When I test end to end scenario, I could see the following error via sxmb_moni & the file is not getting processed

com.sap.aii.utilxi.misc.api.BaseRuntimeException; Fatal Error:

> com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data

> allowed here: (hex) 54, 65, 73(:main:, row:8851, col:24)