|
|
|
|
XMLWrite (Function) In french: XMLEcrit Creates or modifies the value of an XML element or the value of the attribute for an XML element.
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 get the details of the error, use ErrorInfo.
<XML document>: Character string 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 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 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 / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|