Result = InsertXMLStructure(ParentNode, *Buffer, Structure [, PreviousNode])Description
Insert the specified structure memory as a new XML node into the given parent node.
ParentNode The node into which to insert the new node. To insert the new node at the root of the tree, RootXMLNode() can be used here. *Buffer The address of the structure to insert into the XML tree. Structure The type of the structure to insert. PreviousNode (optional) A childnode of 'ParentNode' after which the new node should be inserted. If this value is 0 or not specified, the new node is inserted as the first child of its parent. If this value is -1, the node is inserted as the last child of its parent.
The new XML node if it was created successfully or zero if no node could be inserted at this point.
The rules specified in the CreateXMLNode() for where a new node can be inserted also apply to this function.
The inserted node is named like the structure. Each structure element is added as a sub-node inside the structure node. Any '*' or '$' character is stripped from the name of the structure element. If the structure element contains an array, list, map or structure, more nodes are added recursively. See below for an example of the created XML.
; This example produces the following XML tree: ; ; <Person> ; <Name>John Smith</Name> ; <Age>42</Age> ; <Books> ; <element>Investing For Dummies</element> ; <element>A Little Bit of Everything For Dummies</element> ; </Books> ; </Person> ; Structure Person Name$ Age.l List Books.s() EndStructure Define P.Person P\Name$ = "John Smith" P\Age = 42 AddElement(P\Books()): P\Books() = "Investing For Dummies" AddElement(P\Books()): P\Books() = "A Little Bit of Everything For Dummies" If CreateXML(0) InsertXMLStructure(RootXMLNode(0), @P, Person) FormatXML(0, #PB_XML_ReFormat) Debug ComposeXML(0) EndIf
ExtractXMLStructure(), InsertXMLArray(), InsertXMLList(), InsertXMLMap()