PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Current position
  • Deletion 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
XMLDelete (Function)
In French: XMLSupprime
Deletes the current element (as well as the entire branch) from an XML document.
Versions 17 and later
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Android This function is now available for the Android applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget 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.
// 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(<Name of XML Document>)
<Result>: Boolean
  • True if the deletion is performed,
  • False otherwise. In this case, the ErrorOccurred variable is set to True. To find out the error details, use ErrorInfo.
<Name of XML Document>: Character string with quotes
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.

Deletion during a search

XMLDelete used during a search 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 XMLBuildString. 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 fSaveText.
Example:
// Once the XML document was modified
XMLSource = XMLBuildString("XMLDoc")
// Save the XML file
fSaveText("ModifiedExample.xml", XMLSource)
Components
WINDEVWEBDEV - Server codeReports and Queries wd230xml.dll
Windows Mobile wp230xml.dll
Java wd230java.jar
Linux wd230xml.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment