ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XML file functions
  • Usage example of the XMLDelete function
XMLDelete (Example)
Usage example of the XMLDelete function
XMLSource is string
Res is boolean
 
// Load an existing XML file
XMLSource = fLoadText(fExeDir() + ["\"] + "Example.xml")
Res = XMLDocument("XMLDoc", XMLSource)
 
// Was the document created?
IF Res = False THEN
Error("The document was not created.")
RETURN
END
 
// Find the first "Connection" tag
XMLFind("XMLDoc", "Connection", XMLTag, XMLExact)
 
// Delete the entire tag
XMLDelete("XMLDoc")
 
// Save the modified XML file
XMLSource = XMLBuildString("XMLDoc")
fSaveText(fExeDir() + ["\"] + "ModifiedExample.xml", XMLSource)
Content of the "Example.xml" file:
<CONNECTIONS>
<Connection>
<ConnectionName>NameConnectionOne</ConnexionName>
<Supplier>6</Supplier>
<DataSource>DataSourceOne</DataSource>
<Database>Database1</Database>
<User>User1</User>
<Password>Pass1</Password>
</Connection>
<Connection>
<ConnectionName>NameConnectionX</ConnectionName>
<Supplier>5</Supplier>
<DataSource>DataSource2</DataSource>
<Database>Database2</Database>
<User>User2</User>
<Password>Pass2</Password>
</Connection>
</CONNECTIONS>
Content of the "ModifiedExample.xml" file:
<CONNECTIONS>
<Connection>
<ConnectionName>NameConnectionX</ConnectionName>
<Supplier>5</Supplier>
<DataSource>DataSource2</DataSource>
<Database>Database2</Database>
<User>User2</User>
<Password>Pass2</Password>
</Connection>
</CONNECTIONS>
Minimum version required
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help