Home | Sign in | French EN
  • Special cases
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
Returns the value of an XML element or the value of the attribute for an XML element.
MyDoc is string = fLoadText("example.xml")
XMLDocument("DOM", MyDoc)
sFunctionName is string = XMLRead("DOM","/Example/Help/Function")
sFunctionType is string = XMLRead("DOM","Help/Function/@type")
sFunctionName2 is string = XMLRead("DOM","Help/Function[2]")
sImage is string = XMLRead("DOM","Help[2]/@image")
sImageType is string = XMLRead("DOM","/Example/Help[@image=""line.jpg""]/@format", "NotDefined")
// Applies to the next XML document:
// <Example>
// <Help>
// <Function type="1">Read</Function>
// <Function>Write</Function>
// </Help>
// <Help image="line.jpg" format="jpg" />
// </Example>
<Result> = XMLRead(<XML document> , <Path of element to read> [, <Not found>])
<Result>: Character string
  • Value of element or value of attribute,
  • Empty string ("") or value of <Not found> parameter in the following cases:
    • if the element was not found.
    • if the element has no value
    • if the XPath query is not a query for selecting records.
      In this case, the ErrorOccurred variable is set to True and ErrorInfo returns more details about the error.
<XML document>: Character string (with quotes)
Name of XML document where the reading will be performed. This document contains the XML code to study and it was created by XMLDocument.
<Path of element to read>: Character string (with quotes)
Can correspond to:
  • the path of the value to read in the XML file. Caution: the case is taken into account (lowercase and uppercase characters). To read 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>.
<Not found>: Optional character string (with quotes)
Text to return if the element was not found. This parameter corresponds to an empty string ("") by default.

Special cases

  • XMLRead does not modify the current position in the document.
  • Several XML browse queries cannot be nested.
  • XMLRead must not be used with an XMLDocument variable. To read the content of an XMLDocument variable, use the "FOR EACH" syntax.
Business / UI classification : Business Logic
Component : wd250xml.dll
Minimum version required
  • Version 12
This page is also available for…
Click [Add] to post a comment