cancel
Showing results for 
Search instead for 
Did you mean: 

How do you modify xmlns in the generated xml from XI mapping?

Former Member
0 Kudos

I am generating an xml file from XI mapping. Input is a simple xml (message type) and output is external definitions created by importing xsd. XML is in the end of this post.

<b>Issue</b>

1. In this xml, there are some elements with ns0 and others are not. When XML validator runs, it complains:

<b>"System.FormatException: Missing RecruiterReference/UserName element for Job with jobRefCode=001234 ....."</b>

How can I either have all the elements with ns0 or no qualifier in any element.

2. I need to add the following in the jobs (root) tag or job tag. How can I do that? Target system needs this to validate in order to validate against the schema.

<i>xmlns="http://schemas.monster.com/Monster" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.monster.com/Monster http://schemas.monster.com/Current/xsd/Monster.xsd"</i>;

<b>Schema used</b>

This is the xml schema I am using. I have created external definitions by importing this schema and common.xsd and enumeration.xsd as well:

<a href="http://schemas.monster.com/Current/XSD/Job.xsd">http://schemas.monster.com/Current/XSD/Job.xsd</a>

<b>Generated XML</b>

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

<b><ns0:Jobs xmlns:ns0="http://schemas.monster.com/Monster"></b>

<ns0:Job jobRefCode="001234" jobComplete="true" jobAction="addOrUpdate">

<ns0:RecruiterReference>

<b><UserName>NIS123456_jsmith</UserName></b>

</ns0:RecruiterReference>

<ns0:CompanyReference>

<CompanyXCode>xnis123456_jsmithx</CompanyXCode>

<CompanyName><![CDATA[

John Smith Press

]]></CompanyName>

</ns0:CompanyReference>

<ns0:Channel monsterId="58">

</ns0:Channel>

<JobInformation>

<JobTitle><![CDATA[

Printer

]]></JobTitle>

<JobType monsterId="1">

</JobType>

<JobStatus monsterId="4">

</JobStatus>

<Contact hideAll="false" hideStreetAddress="false" hideCity="false" hideState="false" hidePostalCode="false" hideCountry="false" hideContactInfoField="false" hideCompanyName="false" hideEmailAddress="false" hideFax="false" hideName="false" hidePhone="false">

<StructuredName>

<GivenName><![CDATA[

John

]]></GivenName>

<FamilyName><![CDATA[

Smith

Any help will be appreciated.

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Umesh,

You can use XMLAnonymizer bean to achieve this.

Have a look into

<a href="/people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean">Remove namespace prefix with the XMLAnonymizerBean</a> by Stefan

Regards,

Jai Shankar

Former Member
0 Kudos

Can I just specify

<i>xmlns="http://schemas.monster.com/Monster" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.monster.com/Monster http://schemas.monster.com/Current/xsd/Monster.xsd"</i>;

in <b>anonymizer.acceptNamespaces</b> on the receiver channel?

Would it remove all the ns0 as well from all the tags?

Is this XMLAnonymizerBean installed by default or I need to install it? I am using NW 2004s PI7.0.

Shabarish_Nair
Active Contributor
0 Kudos

http://help.sap.com/saphelp_nw04/helpdata/en/45/d169186a29570ae10000000a114a6b/content.htm

use that link to know more about XMLAnonymizerBean along with the blog mentioned.

The module will be there with NW 2004s PI7.0.

Former Member
0 Kudos

I am trying XMLAnonymizerBean module, but it is not adding the namespace. I believe, this module would just retain the specified namespace(s), if present already but does not add any new namespace.What do you guys think?

peter_wallner2
Active Contributor
0 Kudos

Hello Umesh,

I am facing a similar problem.

How did you solve this?

Thanks for your reply,

Peter