ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / XML file functions
  • Managing the addition
  • Saving the modifications in the XML file
  • XML functions and threads
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
XMLAddAttribute (Function)
In french: XMLAjouteAttribut
Adds an attribute into an XML document. This attribute is added at the end of list of attributes for the current position.
Java The list of attributes is sorted in alphabetical order. Therefore, this attribute is added according to the alphabetical order.
Example
// Ajout d'une nouvelle ligne de commande
XMLParent("CdeXML")
XMLAddChild("CdeXML", "lignecommande", "", True)
XMLAddAttribute("CdeXML", "numero", "2")

// Ajout de la balise "codeproduit"
XMLAddChild("CdeXML", "codeproduit", "sro2125")

// Ajout de la balise "designation"
XMLAddChild("CdeXML", "designation", "souris optique")

// Ajout de la balise "quantité"
XMLAddChild("CdeXML", "quantité", "15")
Syntax
XMLAddAttribute(<Name of the XML document> , <Attribute name> [, <Attribute value> [, <Change of position>]])
<Name of the XML document>: : Character string
Name of the XML document into which the addition must be performed. This document contains the XML code and it was created by XMLDocument.
<Attribute name>: Character string
Name of the attribute to add.
<Attribute value>: Optional character string
Value of the new attribute. This parameter corresponds to an empty string by default.
<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) to avoid modifying the current position during the addition.
Remarks

Managing the addition

  • If the current position is an attribute, the new attribute is added at the end of the current list of attributes.
  • The current position in the document does not change when XMLAddAttribute is called (except if <Change of position> is set to True).

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.
Example:
// Après modification du document XML 
SourceXML = XMLBuildString("DocXML")
// Enregistrement du fichier XML
fSaveText("ExampleModifié.xml", SourceXML)

XML functions and threads

If your application uses threads, the XML document is shared between all these threads. For more details on threads, see Managing threads.
Component: wd300xml.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help