on 02-28-2012 5:04 PM
According to the requirement,I have a large appended .txt file.
This .txt file is created by appending various xml files (without the namespace and root node).
I need to add a root node and namespace declaration to the large appended .txt file so that it can be read as .xml.
Please provide the pointers for the same.
Thanks & Regards,
Rashi
Hi Rashi,
While doing content conversion, fill values for Recordset Name and Recordset Namespace. The communication channel will now create a root node using Recordset Name and namespace as Recordset Namespace at runtime before sending the message to Integration engine. And do not use "ignoreRecordsetName = true" property in FCC.
And let me know how it goes.
Rewards points if useful.
Regards,
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
I was able to meet this requirement with the help of shell script in Run Operating System Command after message processing.
The shell script was written in a way that it added the xml declaration tag(<?xml version="1.0" encoding="UTF-8"?>) and root node(Say <ns0:MT_Result >) in the final.xml file.
After these two lines,the content of appended.txt was added.
And then I added a closing tag for the root node(In this case </ns0:MT_Result >).
The final.xml looks like below-
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Result>
<input>
<Store>
<StoreHeader>
<StoreNbr>56</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
<input>
<Store>
<StoreHeader>
<StoreNbr>56</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
</ns0:MT_Result>
Regards,
Rashi
Use XSLT /Java mapping in the operation mapping before any message mapping.
The XSLT/Java mapping should add the root node and namespace. Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if these appended XML files are of the same stucture can u try this
when u define ur message type remove the namespace from ur message type and make sure the occurrence is unbounded
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can implement using XSLT or java mapping. You might not able to use XMLAnonymizerbean in this case.
You might want to check for how to use java mapping
http://wiki.sdn.sap.com/wiki/display/XI/JavamappingwithDOMandSAXparsersinnewmappingAPI(PI+7.1)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My appended file looks like following.
<input>
<Store>
<StoreHeader>
<StoreNbr>56</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
<input>
<Store>
<StoreHeader>
<StoreNbr>123</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>B</Item>
<ItemPrice>8</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
Now according to the requirement, I need to add namespace and root node and make it like follows:
<ns0:output xmlns:ns0="http://xxx">
<input>
<Store>
<StoreHeader>
<StoreNbr>56</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
<input>
<Store>
<StoreHeader>
<StoreNbr>123</StoreNbr>
<StoreType>Retail</StoreType>
<StoreSite>2004</StoreSite>
</StoreHeader>
<Transactions>
<Transaction>
<Item>A</Item>
<ItemPrice>4</ItemPrice>
</Transaction>
<Transaction>
<Item>B</Item>
<ItemPrice>8</ItemPrice>
</Transaction>
<Transaction>
<Item>C</Item>
<ItemPrice>56</ItemPrice>
</Transaction>
</Transactions>
</Store>
</input>
</ns0:output>
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.