PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Managing the addition
  • Saving the modifications in the XML file
  • XML functions and threads
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
XMLAddAttribute (Function)
In French: XMLAjouteAttribut
Adds an attribute into an XML document. This attribute is added at the end of the list of attributes for the current position.
AndroidAndroid Widget Java The list of attributes is sorted in alphabetical order. Therefore, this attribute is added according to the alphabetical order.
Versions 17 and later
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
// Add a new order line
XMLParent("XMLOrd")
XMLAddChild("XMLOrd", "orderline", "", True)
XMLAddAttribute("XMLOrd", "number", "2")

// Add the "productcode" tag
XMLAddChild("XMLOrd", "productcode", "sro2125")

// Add the "description" tag
XMLAddChild("XMLOrd", "description", "optical mouse")

// Add the "quantity" tag
XMLAddChild("XMLOrd", "quantity", "15")
Syntax
XMLAddAttribute(<Name of XML Document> , <Attribute Name> [, <Attribute Value> [, <Change of Position>]])
<Name of XML Document>: : Character string (with quotes)
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 (with quotes)
Name of the attribute to add.
Versions 17 and later
AndroidAndroid Widget Caution: You cannot create elements (tag or attribute) with accented characters.
New in version 17
AndroidAndroid Widget Caution: You cannot create elements (tag or attribute) with accented characters.
AndroidAndroid Widget Caution: You cannot create elements (tag or attribute) with accented characters.
<Attribute Value>: Optional character string (with quotes)
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 value) 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).
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 AppJavaPHPAjaxUser code (UMC)

Saving the modifications in the XML file

To save the modifications performed in an XML file, you must:
  1. Use XMLBuildString. 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 fSaveText.
Example:
// Once the XML document was modified
XMLSource = XMLBuildString("XMLDoc")
// Save the XML file
fSaveText("ModifiedExample.xml", XMLSource)

XML functions and threads

If your application is using threads, the XML document is shared among all these threads. See Managing the threads for more details.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230xml.dll
Windows Mobile wp230xml.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230xml.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment