cancel
Showing results for 
Search instead for 
Did you mean: 

Appending ns1: in Every field[MAPPING PROBLEM]

Former Member
0 Kudos

Hi All,

I am facing a strange problem when generating the output XML file. The file is generating in XML format with an additional ns1 in each line.

Any idea on this guys.

<b>

<ns1:iABC xmlns:ns1="http://www.ABC.com/xmlschema/ABC/">

<ns1:header>

<ns1:flow>ACT</ns1:flow>

<ns1:sender name="XYZ">

</ns1:sender>

<ns1:receiver name="PQR">

</ns1:receiver>

<ns1:generationDate>2008-05-19</ns1:generationDate>

<ns1:fileIdent>2008/05/19T13:32:00</ns1:fileIdent>

</ns1:header>

<ns1:ID ="0000000000000000000000012"></b>

Many Thanks,

JGD

Edited by: JGD on May 19, 2008 2:56 PM

Accepted Solutions (0)

Answers (11)

Answers (11)

Former Member
0 Kudos

Stefan,

It is really giving me the same output without the namespace.

Even tried to use it<b> http://aaaaaaaa/bbbb/cccc "</b>

<b>output generated:</b>

<?xml version='1.0' encoding='utf-8'?>

<iSeriesCspIntegration>

<header>

..

.

..

</iSeriesCspIntegration>

<b>XSD USED:</b>

<?xml version="1.0" encoding="ISO-8859-1"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:cf="http://www.ABC.com/xmlschema/cspintegration/" targetNamespace="http://www.checkfreeisolutions.com/xmlschema/cspintegration/" elementFormDefault="unqualified" attributeFormDefault="unqualified">

stefan_grube
Active Contributor
0 Kudos

Check for trailing spaces in the parameters and check for typos.

Stefan

Former Member
0 Kudos

Guys,

No idea on :::

<b> simple SAX based java program that transforms the message mapping xml to the format you need. </b>

Where to write how to populate ,,,

But right now after using the bean found that it is deleting the namespace along with the prefix.

Is there any other else that can be done to overcome this.

Many Thanks,

JGD.

Edited by: JGD on May 20, 2008 1:34 PM

Former Member
0 Kudos

Hi Stefan,

I tried with the bolg provided by you it seems that the prefix is deleted so also it is deleting the namespace.

Here is what i have provided in the Communication Channel:

<b>

Module Name = AF_Modules/XMLAnonymizerBean

Type = Local Enterprise bean

Parameter Name = anonymizer.acceptNamespaces

Parameter Value = " http://aaaaaaaa/bbbb/cccc

</b>

The output generated :

<?xml version='1.0' encoding='utf-8'?>

<iSeriesCspIntegration>

<header>

..

..

</iSeriesCspIntegration>

Yes the prefix are deleted but this is also deleting the Namespace, which should not be the case.

Former Member
0 Kudos

Hi,

well, that's really a problem

Do you have any complicated logic in your message mapping?

I think you have 2 options:

1 to use plain java mapping

2 to use 2 steps mapping:

- Message mapping

- simple SAX based java program that transforms the message mapping xml to the format you need.

Best regards

Dmitry

stefan_grube
Active Contributor
0 Kudos

> Parameter Value = " http://aaaaaaaa/bbbb/cccc

First the namespace, then the prefix:

Parameter Value = http://aaaaaaaa/bbbb/cccc ''

I tested with the example in the blog and it worked for me.

Regards

Stefan

Former Member
0 Kudos

Good to here from you guys,

I have already made the changes in the XSD and made it unqualified , also i have made the changes Message Type by makeing the XML Namespace as <b> Blank. </b>

Now the only problem is, i am geting <b>ns0:</b> only at the starting and at the end . Please check the below details for complete understanding.

<i>

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

<ns0:iSeriesCspIntegration xmlns:ns0="http://www.ABC.com/xmlschema/cspintegration/"></b><header>

...

...

...

..

<b></ns0:iSeriesCspIntegration></b></i>

Stefan,

I am trying with the web-blog provided by you , and check it out, but seems to be not happening.

I am testing right now , will be soon update it to you guys.

Many Thanks,

JGD.

Edited by: JGD on May 20, 2008 12:46 PM

Former Member
0 Kudos

Yes both seems to be same.

But the client doesn't want that extra ns0 or ns1 padded to the generated xml file:

So any idea to overcome this one.

Many Thanks.

stefan_grube
Active Contributor
0 Kudos

Depending on the adapter type, you can use the XMLAnonymizerBean to remove the namespace prefixes.

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

Regards

Stefan

Former Member
0 Kudos

Hi,

I am geting one text file and generating one xml file. The target structure is from a xsd provided by client.

I am geting all my fields perfectly as expected , the only problem in the output xml file generated with an extra <b>"ns0:" </b> added to the starting and the ending line.

Now i just want to remove that from my output xml file.

So any idea on this will be of great help.

Many Thanks.

Edited by: JGD on May 20, 2008 7:37 AM

stefan_grube
Active Contributor
0 Kudos

So you want something like this?

<iABC xmlns="http://www.ABC.com/xmlschema/ABC/">

<header>

...

But this is equivalent to:

<ns1:iABC xmlns:ns1="http://www.ABC.com/xmlschema/ABC/">

<ns1:header>

...

So you should check, if you cannot go for your first approach.

Regards

Stefan

Former Member
0 Kudos

Hi Sameer/All,

I somehow manage to get rid of the prefix that was attached to each and every line.

But now the problem is it is only appending at the starting and at the end of the file:

<i>

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

<ns0:iSeriesCDEF xmlns:ns0="http://www.ABC.com/xmlschema/CDEF/"></b>

<header>

<flow>ACTRSP</flow>

<sender name="AB"></sender><b>

</ns0:iSeriesCDEF></b>

</i>

Any way to bypass this wiould of great help...

Many Thanks,

JGD.

stefan_grube
Active Contributor
0 Kudos

Could you let us know what exactly you are doing and what result you want?

The XML message is just the way how you define it in the XSD.

Regards

Stefan

Former Member
0 Kudos

Sameer,

I am using an XSD provided by the thrd party to produce my target structure.

So source is just a text file and target is an xml file(Use XSD structure)

So when i remove the xml namespace in the source MT then it is running into error in the mapping test run.

Here is the header of the XSD used:

<?xml version="1.0" encoding="ISO-8859-1"?>

<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:cf="http://www.ABC.com/xmlschema/cspintegration/" targetNamespace="http://www.ABC.com/xmlschema/cspintegration/" elementFormDefault="qualified" attributeFormDefault="unqualified">

Any idea on this will be of great help.

Many thanks,

JGD.

Former Member
0 Kudos

The problem is

elementFormDefault="qualified"

The XSD explicitly says, that the xml should always contain prefix for each element.

If you remove this declaration, message mapping will generate xml with the prefix for the first tag in this namespace only.

Best regards

Dmitry Yankovsky

stefan_grube
Active Contributor
0 Kudos

Hi Dmitry,

nice to hear something of you.

I think the point is, that the result should be without any namespace prefix at all.

Can this be done with graphical mapping tool?

Regards

Stefan

Former Member
0 Kudos

Hi Stefan

Sure, but then the xsd should declare the default namespace as empty string.

Then its "no namespace" and mapping tool doesn't declare any prefixes.

Best regards

Dmitry

stefan_grube
Active Contributor
0 Kudos

Hi Dmitry,

I mean: namespace yes, prefix no.

Like this:

<iABC xmlns="http://www.ABC.com/xmlschema/ABC/">

<header>

...

Cheers

Stefan

Former Member
0 Kudos

Hi Stefan.

Well, the answer is "no"

According to XML spec both declarations

<iABC xmlns="http://www.ABC.com/xmlschema/ABC/">

and

<ns:iABC xmlns=ns:"http://www.ABC.com/xmlschema/ABC/">

are semantically identical.

Any standard xml parser will work with both declarations the same way. The mapping tool always use the first way.

Sometimes legacy systems use "xml like" format with some special restrictions.

In this case the only way to handle that is to use workarounds like with the anonymizer bean.

Another problem I'm aware of is the target file encoding. That's "not officially" solved with hidden menu which you can see if you hold CTRL+SHIFT keys and right click on data flow editor. The last menu item is "encoding" - you can set the encoding of the resulting xml there

Best regards

Dmitry

stefan_grube
Active Contributor
0 Kudos

> Another problem I'm aware of is the target file encoding. That's "not officially" solved with hidden menu which you can see if you hold CTRL+SHIFT keys and right click on data flow editor. The last menu item is "encoding" - you can set the encoding of the resulting xml there

Hi Dmitry,

I think we should not recommend the hidden tools, as there is no hint in mapping editor, that the encoding is changed. And it is not supported in 7.1, so there might be issues after upgrade.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan.

I'm not recommending that.I just found this feature by playing around with SAP message mapping tool

BTW, as I know there should never be any problems after upgrade if the mapping is not changed. Any old mappings working with old runtime with pre-generated code. If the mapping wasn't open for editing, it always work as before.

Best regards

Dmitry

Former Member
0 Kudos

Hi,

This is coming in the mapping.

Whenever i select one target node(Suppose say the name node) then in the mapping logic it is showing me as

<b>ns0:Name</b>

Any idea gurus,

Many thanks,

JGD.

Former Member
0 Kudos

have a look at my blog

/people/sameer.shadab/blog/2005/12/05/how-to-remove-namespaces-in-mapping--xi

regards

Sameer

Former Member
0 Kudos

Hi Sameer,

Thanks for your quick reply,

Could you please elaborate this.

Many thanks

JGD.

Former Member
0 Kudos

Remove the values from the XML Namespace tab, while creating the Message Type.

regards

Sameer