Skip to Content
0
Former Member
Dec 14, 2005 at 03:31 PM

Adding namespace doens't work

121 Views

Hi,

I need to add the namespace to a IDOC. It seens to, that XI doesn't add the namespace for IDOC.

To do that I implement a java mapping like this :

public void execute(InputStream in, OutputStream out)

throws StreamTransformationException {

Document source = null; // Source message

String sourceString = null; // Source XML message as a string

// Create out of the InputStream the Source XML document

try {

DocumentBuilderFactory factory =

DocumentBuilderFactory.newInstance();

source = factory.newDocumentBuilder().parse(in);

// Add namespace to document

Element root = source.getDocumentElement();

String messageNamespace = null;

messageNamespace = (String)param.get(StreamTransformationConstants.INTERFACE_NAMESPACE);

root.setAttribute("xmlns",messageNamespace);

......

During runtime the result of this mapping ist the following :

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

<ORDERS05 xmlns="urn:sap-com:document:sap:idoc:messages">

<IDOC xmlns="" BEGIN="1">

<......

Why the mappingruntime add the xmlns="" in the IDOC tag ?

Any hints ?

Regards,

Gerald