PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Definition
  • Principle
  • Two methods
  • Using an xmlDocument variable
  • Using a string variable
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
WINDEV, WINDEV Mobile and WEBDEV include several functions for handling the XML code. The XML code used must comply with the XML standard. See a documentation specific to XML for more details.
The XML code is used for example:
Versions 17 and later
iPhone/iPad This feature is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is now available for the iPhone/iPad applications.
iPhone/iPad This feature is now available for the iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Universal Windows 10 App This feature is now available in Universal Windows 10 App mode.
Definition
XML is a language containing tags and attributes (called "elements" in this help).
The structure of an XML code corresponds to a tree structure: the information is organized hierarchically.
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 Webservice.
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 Webservices.
  • import data (HImportXML).
Principle

Two methods

Two methods can be used to handle an XML document:
  1. Using an xmlDocument variable (Recommended method). This method allows you to use a XSD file.
    Versions 17 and later
    Android This type of variable is available from Android version 2.2.
    New in version 17
    Android This type of variable is available from Android version 2.2.
    Android This type of variable is available from Android version 2.2.
  2. Using a string variable to store the XML document. Then, the XML document can be handled by the 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:
    • select "Project .. List of project elements" and click the "Add" button.on the "Project" pane, in the "Project" group, click . The list of project elements is displayed. Click the "Add" button and select the XML document. on the "Project" pane, in the "Project" 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 and Drop" the file to the "XML descriptions" folder of the "Project explorer" pane.
    • in the "Project explorer" pane, select the "XML descriptions" pane then "Import an XML description file" from the popup menu. in the "Project explorer" pane, select the "XML and XSD descriptions" pane then "Import an XML into this project" from the popup menu.
  2. The XML document appears in the "XML descriptions" folder of the project explorer. You have the ability to see its structure.The XML document appears in the "XML and XSD 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).
    Notes:
    • This declaration can be automatically obtained by dropping the name of the document from the project explorer.
    • 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 now have the ability to access the variable nodes by their names. These names are automatically proposed by the mechanism for automatic completion of the code editor.
Note: XMLSave is used to save the XML document. If an XSD file was used, it will be automatically taken into account.
Versions 17 and later
Android You can use an xmlDocument variable from Android version 2.2.
New in version 17
Android You can use an xmlDocument variable from Android version 2.2.
Android You can use an xmlDocument variable from Android version 2.2.

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 it 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: You also have the ability to create an XML document:
Related Examples:
Reading and writing in XML format Unit examples (WINDEV): Reading and writing in XML format
[ + ] Using the XMLxxx functions to:
- Create an XML document
- Read an XML document
XML parser Unit examples (WINDEV): XML parser
[ + ] Studying the content of an XML file via the XMLxxx functions of WINDEV
WD Syntactic Coloring Training (WINDEV): WD Syntactic Coloring
[ + ] This example proposes a base class used to perform a standard syntactic coloring on some text.
This coloring is based on a rough analysis of the lemmes found in a text in order to identify the elements of a programming language for instance.
It can be overloaded or derived in order to customize the system and the coloring language.
This example is used to color SQL code and XML code but it can be extended to color other languages or other text formats.
WD Multimedia Complete examples (WINDEV): WD Multimedia
[ + ] This example explains how to play videos (AVI, MPEG, and so on), sounds (AUDIO CD, MP3, WAV) and animations (Flash) with the WLanguage functions. The following topics are presented in this example:
1/ how to handle the sounds and the videos in WLanguage
2/ how to exploit a "Flash" animation
3/ how to clip windows
4/ how to manage a playlist
5/ how to generate playlists with the XML functions
Summary of the example supplied with WINDEV:
This example is used to read all types of multimedia files. It manages a playlist that can be modified, saved and opened.
This example helps you include multimedia resources in your applications.
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment