This example creates a Tag-List with Attributes
The output of this example is the following XML file:
WCCOAui1:["Xml-Document = ... WCCOAui1:<Spaghetti-Bolognese> WCCOAui1: <Minced-Meat amount="800g"/> WCCOAui1: <Tomato-Concentrate amount="280g"/> WCCOAui1: <Peeled-Tomatoes amount="1.6kg" type="Italian"/> WCCOAui1: <Pasta-Mix-of-Spices/> WCCOAui1: <Dried-Oregano-Powder/> WCCOAui1: <Cutup-Shallots amount="6 big ones"/> WCCOAui1: <Sliced-Champignons amount="12 pieces" type="...de Paris"/> WCCOAui1: <Other-Ingredients pepper="chili" salt="optional" oil="Olive"/> WCCOAui1:</Spaghetti-Bolognese> WCCOAui1:"]
One creates first the top-element container:
root = xmlAppendChild ( document , -1 , XML_ELEMENT_NODE , "Spaghetti-Bolognese" );
The code in the example then calls only ONCE the 'fwXml_appendChildContent()' function:
fwXml_appendChildContent ( document , root , sause_content , sause_various , empty_v , exceptionInfo );
The return parameter 'exceptionInfo' indicates the user of any errors...
The dynamic string 'sause_content' and 'sause_various' contain all the necessary information:
sause_content = makeDynString ( "Minced-Meat", "Tomato-Concentrate", "Peeled-Tomatoes", "Pasta-Mix-of-Spices", "Dried-Oregano-Powder", "Cutup-Shallots", "Sliced-Champignons", "Other-Ingredients" ); meat["amount"] = "800g"; conc["amount"] = "280g"; toma["amount"] = "1.6kg"; toma["type"] = "Italian"; shal["amount"] = "6 big ones"; cham["amount"] = "12 pieces"; cham["type"] = "...de Paris"; ingr["oil"] = "Olive"; ingr["pepper"] = "chili"; ingr["salt"] = "optional"; sause_various = makeDynAnytype(); dynAppend(sause_various,meat); dynAppend(sause_various,conc); dynAppend(sause_various,toma); dynAppend(sause_various,null); dynAppend(sause_various,null); dynAppend(sause_various,shal); dynAppend(sause_various,cham); dynAppend(sause_various,ingr);