Hi Group,
My requirement: Need to change the Namespace tag at the receiver side.
My XML will be something like below:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:ASNList xmlns:ns0="http://www.apriso.com/SXI.GLS">
<EventData>
<SenderName>Test</SenderName>
<ReceiverName>Test</ReceiverName>
<TimeUTC>10:00:00 IST</TimeUTC>
</EventData>
<AdvancedShipmentNotification>
<ID>ASN</ID>
</AdvancedShipmentNotification>
</ns0:ASNList>
I need to transform the message like below;
<?xml version="1.0" encoding="UTF-8"?>
<n1:ASNList xsi:schemaLocation="http://www.apriso.com/PMI.GLS SXI.GLS.ASN.xsd" xmlns:n1="http://www.apriso.com/SXI.GLS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EventData>
<SenderName>LES</SenderName>
<ReceiverName>OSS</ReceiverName>
<EventTimeUTC>2001-12-17T09:30:47.0Z</EventTimeUTC>
</EventData>-
<AdvancedShipmentNotification>
<ID>ASN</ID>
</AdvancedShipmentNotification>
</n1:ASNList>
I have tried to achieve by writing a UDF, all seems to be fine but the "XML is not well-formed". Below is my UDF code:
public String setNSDeclarations(String a,String b,String c,Container container){
StructureNode node = ((StructureNode) container.getParameter("STRUCTURE_NODE"));
node.setNSDeclarations(" xmlns:" + c + "=" + b);
node.setQName(a + "ASNLIST");
return "";
Please suggest if there is any other way to achieve this requirement.
Regards,