|
|
|
|
Guarda un XML Document en un archivo. Si se usó un XSD description, se usa automáticamente para validar el XML Document cuando se guarda.
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 when saving: %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>: Variable de tipo xmlDocument variable xmlDocument que contiene el document a guardar. Esta Variable puede ser el resultado de una llamada a XMLOpen o puede haber sido declarada e inicializada directamente. <File name and path>: Cadena de caracteres ANSI o Unicode opcional Nombre y ruta completa (o relativa) del archivo de texto a crear. Se puede utilizar una ruta de tipo UNC.Si no se especifica este parámetro o si es set a "" (cadena vacía): - Al llamar a la función XMLSave por primera vez en este documento, el documento XML se guarda en la ubicación especificada cuando se abrió (función XMLOpen).
- En posteriores llamadas a XMLSave, el XML Document se guarda en la ubicación especificada la última vez que se guardó.
- Se produce un error si el XML Document no fue abierto por XMLOpen (abierto desde una URL, desde una cadena o si se creó el Document).
<Options>: Constante opcional de tipo Integer Opciones para guardar el XML Document. Los valores posibles son: | | XMLDocumentDefault (valor predeterminado) | Guarda el XML Document con un encabezado. | XMLFormatting | Guarda el XML Document con formato (sangría y retorno de carro). | XMLNoHeader | Guarda el XML Document sin encabezamiento. Esta constante se puede utilizar cuando el Document XML corresponde a un fragmento de un Document más importante, concatenado con otros Document XML a partir de entonces. | xvNoValidation | Guarda el XML Document sin tener en cuenta el modelo XSD especificado al describir el XML Document.
|
Observaciones Cuando se describe una Document XML, se tiene la capacidad de especificar el archivo XSD que se utilizará como modelo de validación para el archivo XML. Por ejemplo: cMyDoc is xmlDocument <description="person.xsd">
Por defecto, este archivo XSD se tiene en cuenta al guardar el Document: la validez del Document se comprueba automáticamente antes de guardar el XML Document (equivalente a XMLValidDocument). Para no realizar esta validación, se debe utilizar la constante xvNoValidation. Clasificación Lógica de negocio / UI: Lógica de negocio
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|