• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Outbound XML file

priya_jde

Member
Hi

I am creating an outbound XML file using business functions 'B0000201- XERCES wrapper'. Everything works well and i have XML file ready.
But i want to add attribute to one of the XML tag in the file, not the root element, but some sub element. I tried to use BSFN 'B0000201 - Add XML Attribute XERCES Wrapper', but it did not work.
For e.g. I have a file
<Root>
<Customer>
<Name>ABC</Name>
<Age> 26</Age>
</Customer>
<Transaction>
<Amount Ccy = "EUR">100.50</Amount>
</Transaction>
</Root>

I want to add 'Ccy' attribute to the tag <Amount>, but it is not working. I have used below functions

1. Create XML Document Xerces Wrapper -B0000201 - Create idRootHandle_GENLNG and document element idDocumentElement_GENLNG
2. Create customer tag. not explaining here.
3. Add XML Element String Xerces Wrapper - B0000201 - Create Transaction group. Free element flag = 0, return pointer idTransactionGroup_GENLNG
4. Add XML Element Math Numeric Xerces Wrapper - B0000201 - Create Amount element, free Element Flag = 1, Return pointer idAmount_GENLNG
5. Add XML Attribute Xerces Wrapper - B0000201 -
idRootHandle_GENLNG -> hXMLDocument
idAmount_GENLNG->hElement
'Ccy'->szElementName
#CRCD->szElementValue

But this creates
<Amount>100.50</Amount>

It doesn't add attribute to it.

Please help.

Thanks,
Priya
 

Imrankhan

Active Member
Hi Priya,

Pass 0 -> BF cFreeElementFlag. It will work
Add XML Element Math Numeric Xerces Wrapper
<Zero> -> BF cFreeElementFlag

Thanks
Imran
 

priya_jde

Member
Thanks Imran for your help. I had created a custom BSFN for this while I was waiting for reply and that worked. But after your post, I used the standard ones and it is working :)
 
Top