Correct use of XML BSFN N7090010

johndanter

Legendary Poster
Hi folks,

I've been tasked with making a XML file for bank transmission and am looking at R744002 and noticing it is almost correct, but I need a few new elements etc.
So I am looking at how it works and noticing the use of N7090010 to first create the file and then add and free the elements.

Is it as simple as that? Is there a special trick to using this BSFN? In the past I have just made the file myself using OpenFlatFile(B34A1010.OpenFlatFile) and then WriteOneLine(B34A1010.WriteOneLine) to start the <element> variable </element> myself.

Now I could sdo this again but would like to starty using what E1 have sent in the box :)

So is there a knack to using these or not?

XMLCreateDocWithAttrib_70(N7090010.XMLCreateDocWithAttrib_70)

XMLAddElement_70(N7090010.XMLAddElement_70)

XMLFreeElement_70(N7090010.XMLFreeElement_70)


Thanks

John

PS: Happy new year all
 

craig_welton

Legendary Poster
Hi John,

Yes, no magic, just simple and useful. Just be cognizant of when you're allocating memory and when and what to free. If you're requesting a returned handle that would be to create a hierarchy level that other elements would be children of. You'll find there are several BSFNs wrapped around the lower level APIs to work with XML. The only issue I remember was it writing in UTF-8 but the XML sig was UTF-16 (or something like that). There was another serialize function that did it properly. I can check tomorrow.

Craig
 

johndanter

Legendary Poster
No worries, thanks

But as for the children elements, if I called XMLAddElement_70 twice before calling XMLFreeElement_70, isn't that how you get the nested children appearing in the XML?
 
Last edited:

craig_welton

Legendary Poster
I haven't used those specific functions, but the concept is the same.

You would call FreeElement for each time you called AddElement and requested it to return the element handle.

<parent>
<child1></child1>
<child2></child2>
</parent>

AddElement "parent" and pass 1 to cReturnElement. idNewElement is the handle to parent
AddElement "child1", pass handle to parent as idParentElement. Don't request element to be returned
AddElement "child2", pass handle to parent as idParentElement. Don't request element to be returned
FreeElement "parent" by passing handle to parent

Craig
 
Top