Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Declaring an xmlNode variable
  • Properties specific to the description of xmlNode variables
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
The xmlNode type is used to handle a node of an XML document. The characteristics of this node can be defined and modified using different WLanguage properties.
This type of variable is used by:
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
MonTexteXML is string = [
<?xml version="1.0"?>
<TITLE>The Tragedy of Romeo AND Juliet</TITLE>
<SCENE><TITLE>SCENE I.  A lane by the wall of Capulet's orchard.</TITLE></SCENE>
// Chargement d'un document XML
RomeoEtJuliette is xmlDocument
RomeoEtJuliette = XMLOpen(MonTexteXML, fromString)
// Affichage du titre des actes
Acte is xmlNode
FOR EACH Acte OF RomeoEtJuliette.PLAY ON ACT
// Validation à partir du schéma défini lors de la déclaration
cMonNoeud is xmlNode, description="schemaXSDDuProjet.NoeudRacine"
// La variable peut également être déclarée de la façon suivante:
// cMonNoeud est un xmlNoeud <description="schemaXSDDuProjet.NoeudRacine">
cMonNoeud.Texte = "21"
IF XMLValidNode(cMonNoeud) = False THEN
Info("Le noeud XML est valide")

Declaring an xmlNode variable

The xmlNode variables can be declared by specifying a template node (node in an XSD file). The structure of this document will be read by WINDEV and the automatic completion will be available for the names of nodes in the code editor.
To declare an xmlNode variable with a sample document:
  1. Add the XML or XSD document into the project.
  2. The XML or XSD document appears in the project browser, in the "XML descriptions" branch. You have the ability to see its structure.
  3. Declare the variable as follows:
    <Nom de la variable> est un xmlNoeud, description =  <Chemin du noeud dans le document XSD>
Remark: the syntax for node declaration can also be obtained by performing a "Drag and Drop" of the node into the project explorer.
The child nodes of the variable can now be directly accessed by their names. These names are automatically proposed by the automatic completion mechanism of the code editor.

Properties specific to the description of xmlNode variables

The following properties can be used to handle an xmlNode variable:
NameType usedEffect
AttributeArray of xmlAttributeArray of XML attributes associated with the node.
  • True if the node exists,
  • False otherwise.
This property is used for example to check the existence of a specific child of a document node.
This property is read-only.
NamespacexmlNamespace variableXML namespace of node.
NamespaceDeclaredArray of xmlNamespaceArray of XML namespaces declared by the node.
ChildNodeArray of xmlNodeArray of child nodes.
NameUNICODE character stringName of node.
OccurrenceIntegerNumber of nodes of same level and with the same name in the XML document.
This property is read-only.
XMLSourceUNICODE character stringFragment of XML code corresponding to the node. This property also returns the XML code of the child nodes.
This property is read-only.
TextUNICODE character stringText found in the node.
TypeIntegerType of node. The possible types are as follows:
  • XMLTag (default value): Simple XML node that may contain children.
    For example:
  • XMLText: XML node containing text.
    For example:
    <NOEUD> Texte </NOEUD>
  • XMLCDATA: XML node containing data that must be ignored by the XML analyzer.
    For example:
    <NOEUD><![CDATA[Ces données ne sont pas
    traitées par l'analyseur XML]]>
  • The type can be assigned once only. Then, the property is read-only.
  • If the Property Nom is assigned, the node will automatically be of type XMLTag.
  • If Property Text is assigned, the node will automatically be of type XMLText.
  • When assigning the Property Text, all child nodes of type XMLText and XMLCDATA are deleted.
Remark: These properties can be used with one of the following syntaxes:
  • <Variable name>..<Property name>
  • <Variable name>.<Property name>
Minimum version required
  • Version 15
This page is also available for…
Click [Add] to post a comment