ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XML file functions
  • Current position
  • Deleting an element during a search
  • Saving the modifications in the XML file
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
XMLDelete (Function)
In french: XMLSupprime
Deletes the current element (as well as the entire branch) from an XML document.
// Deletion during a search
// Positions at the root of document
XMLRoot(:m_sDocName)
LOOP
// Finds all the "txsr" from the root in order to delete them
XMLFind(:m_sDocName, CParagraph::CST_TAG, XMLTag + XMLChildItem + XMLContinue, ...
XMLExact)
IF XMLFound(:m_sDocName) THEN
XMLDelete(:m_sDocName)
ELSE
BREAK
END
END
Syntax
<Result> = XMLDelete(<XML document>)
<Result>: Boolean
  • True if the deletion is performed,
  • False otherwise. In this case, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<XML document>: Character string
XML document from which the deletion will be performed.
  • If the current element is an attribute, the attribute will be deleted.
  • If the current element is a tag, the tag will be deleted as well as all its attributes and all its child elements.
Remarks

Current position

After the deletion, the current position is moved toward the parent of deleted element.

Deleting an element during a search

When used on a search, XMLDelete cancels the search. Example to avoid (this code does not operate):
// Positions at the root of document
XMLRoot(:m_sDocName)
// Finds all the "txsr" from the root in order to delete them
XMLFind(:m_sDocName, CParagraph::CST_TAG, XMLTag + XMLChildItem + XMLContinue, XMLExact)
WHILE XMLFound(:m_sDocName)
XMLDelete(:m_sDocName)
    // Next element in the search
XMLNext(:m_sDocName)
END
XMLCancelSearch(:m_sDocName)
The code to use is given in example of the function.

Saving the modifications in the XML file

To save the modifications performed in an XML file, you must:
  1. Use the XMLBuildString function. 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 the fSaveText function.
Example:
// Once the XML document was modified
XMLSource = XMLBuildString("XMLDoc")
// Save the XML file
fSaveText("ModifiedExample.xml", XMLSource)
Business / UI classification: Business Logic
Component: wd290xml.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/16/2022

Send a report | Local help