PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • 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 25 and later
WEBDEV - Browser code This function is now available in browser code.
New in version 25
WEBDEV - Browser code This function is now available in browser code.
WEBDEV - Browser code This function is now available in browser code.
// Suppression lors d'une recherche
// Positionne à la racine du document
XMLRoot(m_sNomDoc)
LOOP
// Recherche tous les "txsr" à partir de la racine pour les supprimer
XMLFind(:m_sNomDoc, CParagraphe::CST_TAG , XMLTag + XMLChildItem + XMLContinue, ...
XMLExact)
IF XMLFound(m_sNomDoc) THEN
XMLDelete(m_sNomDoc)
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 the details of the error, use ErrorInfo.
<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

The XMLDelete function used during a search cancels the search. Example to avoid (this code does not operate):
// Positionne à la racine du document
XMLRoot(m_sNomDoc)
// Recherche tous les "txsr" à partir de la racine pour les supprimer
XMLFind(m_sNomDoc, CParagraphe::CST_TAG, XMLTag + XMLChildItem + XMLContinue, XMLExact)
WHILE XMLFound(m_sNomDoc)
XMLDelete(m_sNomDoc)
    // Elément suivant dans la recherche
XMLNext(m_sNomDoc)
END
XMLCancelSearch(m_sNomDoc)
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)
Business / UI classification: Business Logic
Component: wd260xml.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment