Help / WLanguage / WLanguage functions / Standard functions / XML file management functions
  • Saving the modifications in the XML file
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
XMLInsertElement (Function)
In french: XMLInsèreElement
Inserts an XML element (tag or attribute) into an XML document. The insertion position is relative to the current position.
AndroidAndroid Widget Java An XML document can only contain a single tag at its root.
<Result> = XMLInsertElement(<XML document> , <Element name> [, <Value of inserted element> [, <Insertion position> [, <Change of position>]]])
<Result>: Boolean
  • True if the insertion was performed,
  • False otherwise (the ErrorOccurred variable is set to True).
    To get more details on the error, use ErrorInfo.
<XML document>: Character string
XML document into which the insertion will be performed.
<Element name>: Character string
Name of element to add. The added element and the current element have the same type:
  • If the current element is a tag, the inserted element is a tag.
  • If the current element is an attribute, the inserted element is an attribute.
<Value of inserted element>: Optional character string
Value of new element. This parameter corresponds to an empty string ("") by default.
<Insertion position>: Optional Integer constant
Position where the addition is performed in relation to the current element. This parameter can take one of the following values:
(Default value)
The insertion is performed in the current level. The inserted part will be a child element of the current element.
XMLNextElementThe insertion is performed just after the current element, in the same branch.
AndroidAndroid Widget Java This constant is ignored for the attributes.
XMLPreviousElementThe insertion is performed just before the current element, in the same branch.
AndroidAndroid Widget Java This constant is ignored for the attributes.
<Change of position>: Optional boolean
  • True to be positioned on the added element. In this case, the added element becomes the current position.
  • False (default value) to avoid modifying the current position during the addition.

Saving the modifications in the XML file

To save the modifications performed in an XML file, you must:
  1. Use the XMLBuildString function. This function retrieves and formats the content of an XML document.
  2. Save the character string generated by XMLBuildString in an XML file. To do so, use the fSaveText function.
// Once the XML document was modified
XMLSource = XMLBuildString("XMLDoc")
// Save the XML file
fSaveText("ModifiedExample.xml", XMLSource)
Business / UI classification: Business Logic
Component: wd280xml.dll
Minimum version required
  • Version 9
This page is also available for…
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help