Inserts the current XML tag found in an XML document into another XML document.
Result1 is boolean
// Inserts the current tag found in MySourceDoc into MyTargetDoc
// This tag will be a child tag of the current tag found in MyTargetDoc
Result1 = XMLInsertDocument("MyTargetDoc", "MySourceDoc", XMLChildItem)
IF Result1 = True THEN
Info("Insertion successful")
ELSE
Info("The insertion failed")
END
Syntax
<Result> = XMLInsertDocument(<Target XML document> , <Source XML document> [, <Insertion position>])
<Result>: Boolean
- True if the insertion is performed,
- False otherwise (the ErrorOccurred variable is set to True).
To get more details on the error, use ErrorInfo.
<Target XML document>: Character string
Name of XML document into which the insertion will be performed.
<Source XML document>: Character string
Name of XML document containing the tag that will be inserted into an XML document.
<Insertion position>: Optional Integer constant
Position where the addition is performed in relation to the current tag in <Target XML document>. This parameter can take one of the following values: | |
XMLChildItem | The insertion is performed in the current level. The inserted part will be a child tag of the current tag. |
XMLNextElement (Default value) | The insertion is performed just after the current tag, in the same branch. |
XMLPreviousElement | The insertion is performed just before the current tag, in the same branch. |
Remarks
Saving the modifications in the XML file
To save the modifications performed in an XML file, you must:
- Use the XMLBuildString function. This function retrieves and formats the content of an XML document.
- Save the character string generated by XMLBuildString in an XML file. To do so, use the fSaveText function.
Example:
// Once the XML document was modified
XMLSource = XMLBuildString("XMLDoc")
// Save the XML file
fSaveText("ModifiedExample.xml", XMLSource)
Business / UI classification: Business Logic