PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
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
Creates or modifies the value of an XML element or the value of the attribute for an XML element.
Versions 15 and later
PHP This function is now available for PHP sites.
New in version 15
PHP This function is now available for PHP sites.
PHP This function is now available for PHP sites.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps 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
XMLDocument("DOM")
XMLWrite("DOM","/Example/Help/Function", "Read")
XMLWrite("DOM", "Help/Function/@type", "1")
XMLWrite("DOM", "Help/Function[2]", "Write")
XMLWrite("DOM", "Help[2]/@image", "line.jpg")
XMLWrite("DOM", "Help[2]/@format", "jpg")
fSaveText("example.xml", XMLBuildString("DOM", XMLDocumentDefault, XMLEncodingIso8859_1))
XMLClose("DOM")

// generated file:
//<?xml version="1.0" encoding="ISO-8859-1"?>
//<Example>
//<Help>
//<Function type="1">Read</Function>
//<Function>Write</Function>
//</Help>
//<Help image="line.jpg" format="jpg" />
//</Example>
Syntax
<Result> = XMLWrite(<XML document> , <Path of element to create or modify> , <String to write>)
<Result>: Boolean
  • True if the element was created or modified,
  • False otherwise (the ErrorOccurred variable is set to True). To find out the error details, use ErrorInfo.
<XML document>: Character string (with quotes)
Name of the XML document into which the write operation must be performed. This document contains the XML code to study and it was created by XMLDocument.
<Path of element to create or modify>: Character string (with quotes)
Can correspond to:
  • the path of the value to read in the XML file. To write the value of an attribute, the name of the attribute must be preceded by the "@" character.
  • the text of an XPath query to run. The XPath query must be a query for "selecting records". If several elements match the selection, the first element found is used.
If this path does not start with "/", the name of the root node is automatically added. If the XML document has no root, <Result> will correspond to <Not found>.
<String to write>: Character string (with quotes)
String that must be written into the specified element.
Remarks
  • XMLWrite does not modify the current position in the document.
  • Several XML browse queries cannot be nested.
  • If a filter is used to create a second element, an error will occur if the first element does not exist.
    Do:
    XMLWrite("DOM", "Help/Function", "Example")
    XMLWrite("DOM", "Help/Function[2]", "Example")

    Don't:
    XMLWrite("DOM", "Help/Function[2]", "Example")
Business / GUI classification : Neutral code
Component : wd250xml.dll
Minimum version required
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment