ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XML file functions
  • Handling elements in the XML code
  • Using XMLChild during a search
  • XML functions and threads
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Positions on the first child element of current element. To select an element, use the functions for XML search and browse (XMLFirst, XMLLast, ...).
Reminder: An element is either a tag or an attribute.
PHP The XML comments (found between the "<!-" and "->" tags) are ignored.
AndroidAndroid Widget Java The browses are performed in alphabetical order of the attributes.
Example
// Create the XML document
XMLDocument("XMLOrd", SourceMyXML)
// Browse performed by XMLFirst and XMLNext
// Positions on "<order>" element
XMLFirst("XMLOrd")
// Goes one level down and positions on "<number>" element
XMLChild("XMLOrd")
// Retrieves the order number
OrdNum is int = Val(XMLData("XMLOrd")) // contains 1
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppJavaUser code (UMC)PHPAjax
// Retrieve the XML content of "orders.xml" file
SourceMyXML is string = fLoadText("orders.xml")
// Create the XML document
XMLDocument("XMLOrd", SourceMyXML)
IF ErrorOccurred = True THEN
Error("Error while creating the XML document")
RETURN
ELSE
// Browse performed by XMLFirst and XMLNext
// Positions on "<order>" element
XMLFirst("XMLOrd")
// Goes one level down and positions on "<number>" element
XMLChild("XMLOrd")
// Retrieves the order number
OrdNum is int = Val(XMLData("XMLOrd")) // contains 1
END
Syntax
<Result> = XMLChild(<XML document>)
<Result>: Boolean
  • True if an element was found,
  • False otherwise. If an error occurs:
    • the current position remains unchanged.
    • the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<XML document>: Character string
Name of the XML document used. This document contains the XML code to study and it was created by XMLDocument.
Remarks

Handling elements in the XML code

After the call to XMLChild, the current element can be handled by XMLElementName, XMLParentName, XMLElementType and XMLData.
Remark: you can use XMLExtractDocument to read only the content of a tag and be notified when you've reached the end with XMLOut.

Using XMLChild during a search

If a search is in progress (XMLFind), XMLChild cancels this search.

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.
If the current position in an XML document is modified in a thread, the current position in this XML document is modified for all the threads.
Component: wd290xml.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help