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
  • Overview
  • Definition
  • Principle
  • Two methods
  • Using an xmlDocument variable
  • Using a string variable
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
Overview
WINDEV, WINDEV Mobile and WEBDEV include several functions for handling XML code. The XML code used must comply with the XML standard. For more details, see the documentation specific to XML.
The XML code is used for example:
Definition
XML is a language containing tags and attributes (called "elements" in this help).
The structure of the XML code corresponds to a tree structure: information is organized in a treelike way.
The following terms are used to describe the different parts of an XML code:

XML vocabulary center


XML code (or content) corresponds to:
  • the content of an XML file.
  • a response from an XML web service.
The XML functions allow you to:
  • read, find and analyze the content of an XML file.
  • modify the content of an XML file.
  • format the content of an XML file.
  • run an XPATH query in the content of an XML file.
  • analyze the responses received from the XML web services.
  • import data (HImportXML).
Principle

Two methods

Two methods can be used to manipulate an XML document:
  1. Using an xmlDocument variable (Recommended method). This method allows you to use an XSD file.
  2. Using a string variable to store the XML document. The XML document can be manipulated using different XML functions.

Using an xmlDocument variable

The xmlDocument variables can be declared by indicating a sample document (XML file) or a template document (XSD file). The structure of this document will be read by WINDEV, WEBDEV and WINDEV Mobile. Therefore, the automatic completion will be available for the names of nodes in the code editor.
To declare an xmlDocument variable with a sample document:
  1. Add the XML document into the project via one of the following methods:
    • on the "Proyecto" tab, in the "Proyecto" group, expand " List of elements" and click "List of project elements". The list of project elements is displayed. Click the "Add" button and select the XML document.
    • drag the file and drop it in the "External descriptions" folder of the "Project explorer" pane.
    • in the "Project explorer" pane, select the "External descriptions" folder, then:
      • "Import an XML or JSON into this project" in the context menu.
      • "Import an XSD into this project" in the context menu.
  2. The XML document appears in the "External descriptions" folder of the project explorer. You have the ability to see its structure.
  3. Declare the variable as follows:
    <Variable name> is xmlDocument, description =  <Document name>

    <Document name> can correspond to the name of sample document (with or without extension) or to the name of template document (with or without extension).
    Remarks:
    • This declaration can be obtained automatically by "dropping" the name of the XML document directly from the "Project Explorer" pane.
    • When using a sample document, you also have the ability to use the following syntax:
      <Variable name> is xmlDocument
      <Variable name> = XMLOpen(<Document name>)
  4. You can directly access the variable nodes by their names. These names are automatically proposed by the automatic completion mechanism of the code editor.
Note: The XMLSave function is used to save the XML document. If an XSD file was used, it will be automatically taken into account.

Using a string variable

To handle an XML code:
  1. Store the XML code in a string variable (fLoadText). This code can come from an XML file or from an XML web service.
  2. Create an XML document (XMLDocument). This document is stored in memory and contains the entire XML code to use.
  3. Handle your XML document with the WLanguage functions. You can:
  4. Save the modifications if necessary (XMLBuildString and fSaveText).
  5. Close the XML document (XMLClose).
Note: It is also possible to create an XML document:
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