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.
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
Saves an XML document in a file.
Versions 15 and later
If an XSD description was used, it is automatically used to validate the XML document when saved.
New in version 15
If an XSD description was used, it is automatically used to validate the XML document when saved.
If an XSD description was used, it is automatically used to validate the XML document when saved.
Example
MonDocumentXML is xmlDocument
...
Filtre is string = "Fichiers XML (*.xml)" + TAB + "*.xml" + CR + ...
"Tous fichiers (*.*)" + TAB + "*.*"
FichierSortie is string = fSelect("", "", "Sélectionnez un fichier XML ...", ...
Filtre, "xml", fselCreate)
IF FichierSortie <>"" THEN
XMLSave(MonDocumentXML, FichierSortie, XMLDocumentDefault)
IF ErrorOccurred = True THEN
ErrorBuild("Une erreur s'est produite pendant la sauvegarde: %1", ...
ErrorInfo(errFullDetails))
END
END
// La description du fichier XML nommé "flux" a été importée dans le projet.
// Un ficher XML vierge va être créé à partir de cette description.
// Le ficher XML n'existe pas encore physiquement.
// Chargement du contenu XML
MonDocXML is xmlDocument,description="flux"
MonDocXML.rss.Channel[1].Title = gsParamTitre
MonDocXML.rss.Channel[1].Link = gsParamAdresseSite
MonDocXML.rss.Channel[1].Description = gsParamDescriptionSite
MonDocXML.rss.Channel[1].Copyright = gsParamCopyright
MonDocXML.rss.Channel[1].Webmaster = gsParamAdesseContact
MonDocXML.rss.Channel[1].Image = gsParamURLImageSite
MonDocXML.rss.Channel[1].Generator = "Easy RSS"
// Sauvegarde du fichier
XMLSave(MonDocXML, gsCheminFichierXML)
// Sauvegarde du fichier avec mise en forme (nouveauté 22)
XMLSave(MonDocXML, gsCheminFichierXML_Avec_MiseEnForme, XMLFormatting)
Syntax
XMLSave(<XML document> [, <File name and path>] [, <Options>])
<XML document>: xmlDocument variable
xmlDocument variable containing the document to save. This variable can be the result of a call to XMLOpen or it may have been declared and initialized directly.
<File name and path>: Optional ANSI or Unicode character string
Name and full (or relative) path of text file to create. A UNC path can be used.
If this parameter is not specified or if it is set to "" (empty string):
  • When XMLSave is called for the first time on this document, the XML document is saved at the location specified during its opening (XMLOpen).
  • On subsequent calls to XMLSave, the Document XML is saved to the location specified on the previous save.
  • An error occurs if the XML document was not opened by XMLOpen (opened from a URL, from a string or if the document was created).
<Options>: Optional Integer constant
Options for saving the XML document.
The possible values are:
XMLDocumentDefault
(default value)
Saves the XML document with a header.
Versions 22 and later
XMLFormatting
New in version 22
XMLFormatting
XMLFormatting
Saves the XML document with formatting (indent and carriage returns).
XMLNoHeaderSaves the XML document without header. This constant can be used when the XML document corresponds to a fragment of a more important document, concatenated with other XML documents thereafter.
xvNoValidationSaves the XML document without taking into account the XSD model specified when describing the XML document.
Remarks
When describing an XML document, you have the ability to specified the XSD file that will be used as validation model for the XML file. For example:
cMonDoc is xmlDocument <description="personne.xsd">
By default, this XSD file is taken into account when saving the document: the validity of the Document is automatically checked before saving the Document XML (equivalent to the XMLValidDocument function). To avoid performing this validation, all you have to do is used the xvNoValidation constant.
Business / UI classification: Business Logic
Component: wd270xml.dll
Minimum version required
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment