AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos XML
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Saves an XML document in a file.
If an XSD description was used, it is automatically used to validate the XML document when saved.
Ejemplo
MyXMLDocument is xmlDocument
...
Filter is string = "XML files (*.xml)" + TAB + "*.xml" + CR + ...
			"All files (*.*)" + TAB + "*.*"
OutputFile is string = fSelect("", "", "Select an XML file...", ...
			Filter, "xml", fselCreate)
IF OutputFile <>"" THEN
	XMLSave(MyXMLDocument, OutputFile, XMLDocumentDefault)
	IF ErrorOccurred = True THEN
		ErrorBuild("An error occurred during backup: %1", ...
				ErrorInfo(errFullDetails))
	END
END
// The description of the XML file named "stream" was imported into the project. 
// A blank XML file will be created from this description.
// The XML file does not physically exist yet.
// Load the XML content
MyXMLDoc is xmlDocument,description="stream"
MyXMLDoc.rss.Channel[1].Title = gsParamTitle
MyXMLDoc.rss.Channel[1].Link = gsParamSiteAddress
MyXMLDoc.rss.Channel[1].Description = gsParamSiteDescription
MyXMLDoc.rss.Channel[1].Copyright = gsParamCopyright
MyXMLDoc.rss.Channel[1].Webmaster = gsParamContactAddress
MyXMLDoc.rss.Channel[1].Image = gsParamURLSiteImage
MyXMLDoc.rss.Channel[1].Generator = "Easy RSS"
// Save the file
XMLSave(MyXMLDoc, gsPathXMLFile)
// Save the file with formatting (new feature of version 22)
XMLSave(MyXMLDoc, gsPathXMLFile_With_Formatting, XMLFormatting)
Sintaxis
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 to the location specified when it was opened (XMLOpen).
  • On subsequent calls to XMLSave, the XML document is saved to the location specified the last time it was saved.
  • 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.
XMLFormattingSaves the XML document with formatting (indent and carriage returns).
AndroidWidget Android This constant is now available.
Java This constant is not available.
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.
AndroidWidget Android Java This constant is not available.
Observaciones
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:
cMyDoc is xmlDocument <description="person.xsd">
By default, this XSD file is taken into account when the document is saved: document validity is automatically checked before saving the XML document (equivalent to the XMLValidDocument function). If you don't want to perform this validation, simply use the constant xvWithoutValidation.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300xml.dll
Versión mínima requerida
  • Versión 15
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local