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
  • Managing the addition
  • Saving the modifications in the XML file
  • XML functions and threads
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
XMLAddAttribute (Function)
Adds an attribute into an XML document. This attribute is added at the end of list of attributes for the current position.
Java The list of attributes is sorted in alphabetical order. Therefore, this attribute is added according to the alphabetical order.
Ejemplo
// Add a new order line
XMLParent("XMLOrd")
XMLAddChild("XMLOrd", "orderline", "", True)
XMLAddAttribute("XMLOrd", "number", "2")

// Add the "productcode" tag
XMLAddChild("XMLOrd", "productcode", "sro2125")

// Add the "description" tag
XMLAddChild("XMLOrd", "description", "optical mouse")

// Add the "quantity" tag
XMLAddChild("XMLOrd", "quantity", "15")
Sintaxis
XMLAddAttribute(<Name of the XML document> , <Attribute name> [, <Attribute value> [, <Change of position>]])
<Name of the XML document>: : Character string
Name of the XML document into which the addition must be performed. This document contains the XML code and it was created by XMLDocument.
<Attribute name>: Character string
Name of the attribute to add.
<Attribute value>: Optional character string
Value of the new attribute. This parameter corresponds to an empty string by default.
<Change of position>: Optional boolean
  • True to be positioned on the added element. In this case, the added element becomes the current position.
  • False (default) to avoid modifying the current position during the addition.
Observaciones

Managing the addition

  • If the current position is an attribute, the new attribute is added at the end of the current list of attributes.
  • The current position in the document does not change when XMLAddAttribute is called (except if <Change of position> is set to True).

Saving the modifications in the XML file

To save the modifications performed in an XML file, you must:
  1. Use the XMLBuildString function. 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 the fSaveText function.
Example:
// Once the XML document was modified
XMLSource = XMLBuildString("XMLDoc")
// Save the XML file
fSaveText("ModifiedExample.xml", XMLSource)

XML functions and threads

If your application uses threads, the XML document is shared between all these threads. For more details on threads, see Managing threads.
Componente: wd300xml.dll
Versión mínima requerida
  • Versión 9
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