InsertXMLMap()

Syntax

Result = InsertXMLMap(ParentNode, Map() [, PreviousNode])
Description
Insert the specified Map() as a new XML node into the given parent node.

Parameters

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.
Map() The map to insert into the XML.
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.

Return value

The new XML node if it was created successfully or zero if no node could be inserted at this point.

Remarks

The rules specified in the CreateXMLNode() for where a new node can be inserted also apply to this function.

The inserted node is named "map" and the contained element nodes are named "element". Each element node will have an attribute named "key" containing the map key of the element. See below for an example of the created XML.

Example

  ; This example produces the following XML tree:
  ;
  ; <map>
  ;   <element key="DE">Germany</element>
  ;   <element key="US">United States</element>
  ;   <element key="FR">France</element>
  ; </map>
  ;
  NewMap Countries.s()
  Countries("DE") = "Germany"
  Countries("FR") = "France"  
  Countries("US") = "United States"

  If CreateXML(0)
    InsertXMLMap(RootXMLNode(0), Countries())
    FormatXML(0, #PB_XML_ReFormat)
    Debug ComposeXML(0)
  EndIf

See Also

ExtractXMLMap(), InsertXMLArray(), InsertXMLList(), InsertXMLStructure()

Supported OS

All

<- InsertXMLList() - XML Index - InsertXMLStructure() ->