RedBatz
18th December 2013, 19:10
Hi,

Can anyone provide me an example how to build a xml tag like this:

<InstdAmt Ccy="EUR">1667.88</InstdAmt>

using function xmlRewriteDataElement?

Thx,

RedBatz

bhushanchanda
19th December 2013, 09:21
Hi,

Try this:-

long i,j,k,l

i = seq.open("C:\temp\test123.txt","w")
j = xmlNewDataElement("InstdAmt",1667.88)
l = xmlSetAttribute (j, "Ccy", "EUR")
k = xmlWrite (i,j)
seq.close(i)

RedBatz
19th December 2013, 12:22
Hi Bhushan,

Thank you for the tip, it is now working.


Regards,

RedBatz.

RedBatz
19th December 2013, 19:30
Buschan,

I have still have a issue while creating a xml file.

The end of file looks like this:

</CstmrDrctDbtInitn>
<CstmrDrctDbtInitn/>
</Document>

And it shoul look like:

</CstmrDrctDbtInitn>
</Document>

Do you have any hint about this situation?


Regards,

RedBatz.

bhushanchanda
19th December 2013, 19:39
Hi,

How are your trying to close those nodes? Can you please post your code, will need to check it.

bhushanchanda
20th December 2013, 06:31
Hi,

From your message, I get to know that you are using something like this to create child nodes:-

xmlNewNode(
"CstmrDrctDbtInitn",
XML_ELEMENT,
CstmrDrctDbtInitnNode)

And hence its giving you the results you mentioned.

Instead of that try something like this:-

i = seq.open("C:\temp\test123.txt","w")
j = xmlNewDataElement("Parent_Node","")
l = xmlSetAttribute (j, "Ccy", "EUR")
l = xmlNewDataElement("Child_Node",456,j)
k = xmlWrite (i,j)
seq.close(i)

RedBatz
20th December 2013, 13:44
Bhushan,

Thank you for the tip, the end of file is now ok!

I have another situation that I don't understand the behavior:

I need to set 2 attributes on the ParentNode:

1-> "xmlns", "urn:iso:std:iso:20022:tech:xsd:pain.008.001.02"

2-> "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"

The first attribute is ok in the file, but the second is incomplete, like

"http://www.w3.org/2001/XML"

Is this caused by some limitation in the attribute string?

Thanks and regards,

RedBatz.