PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Syntax 1: Browsing the elements of XML file on a level
  • Syntax 2: Browse on a level with copy
  • Syntax 3: Browse in depth
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
The FOR EACH statement is used to perform different types of browse on an xmlReader variable:
  • Browse on a level.
  • Browse on a level with copy.
  • Browse in depth.
Note: The FOR ALL, FOR EACH statements are accepted. The FOR EACH statement will be used in this documentation but it can be replaced by FOR ALL.
Example
< ?xml version="1.0"?>
<aa>
<bb>
Text1

<cc>
</cc>
</bb>
<bb>
<cc>
</cc>
</bb>
</aa>
// Browse on a level
// Reader is the variable corresponding to the XML file
FOR EACH Reader
// Read the start aa and end aa tags
FOR EACH Reader
// Read the start bb, end bb, start bb, end bb tags
FOR EACH Reader
// Read Text1 and the start cc, end cc
// start cc, end cc tags
END
END
END
// Reader is the variable corresponding to the XML file
FOR EACH Reader IN DEPTH
// Read the start aa, start bb, text1, start cc, end cc, end bb, start bb,
// start cc, end cc, end bb, end aa tags
END
Syntax

Browsing the elements of XML file on a level Hide the details

FOR EACH <XML Reader>
      FOR EACH <XML Reader>
    ...
      END
END
<FOR EACH>:
Marks the beginning of statement block.
Used to browse the children of current level.
<XML Reader>:
xmlReader variable corresponding to the XML file to browse.
Inside the loop, the xmlReader variable points to the current XML element.
Note: You have the ability to nest browses on the XML reader.

Browse on a level with copy Hide the details

FOR EACH <Element> OF <XML Reader>
       FOR EACH <Element A> OF <Element>
        ...
       END
END
<FOR EACH>:
Marks the beginning of statement block.
Used to browse the children of current level.
<Element>:
Inside the loop, <Element> points to the current XML element. It can be used to perform a new FOR EACH loop to browse its children.
<XML Reader>:
xmlReader variable corresponding to the XML file to browse.

Browse in depth Hide the details

FOR EACH <XML Reader> IN DEPTH
      ...
END

FOR EACH <Element> OF <XML Reader> IN DEPTH
      ...
END
<FOR EACH>:
Marks the beginning of statement block.
Used to browse the XML treeview in depth: browse the child, then the grandchild, then the child of grandchild until a leaf is reached.
<Element>:
Inside the loop, <Element> points to the current XML element. Used to perform a reading in depth from an element.
<XML Reader>:
xmlReader variable corresponding to the XML file to browse.
Remarks

Syntax 1: Browsing the elements of XML file on a level

This syntax is used to browse the children of current level. Inside the loop, the xmlReader variable points to the current XML element.
You have the ability to nest browses on the xmlReader variable in order to browse the children of element on the level currently browsed.

Syntax 2: Browse on a level with copy

This syntax is used to browse the children of current level. Inside the loop, <Element> points to the current XML element and it is possible to use it to perform another browse on its own children.
Note: A single browse can be performed on the <Element> variable.

Syntax 3: Browse in depth

This syntax is used to browse the XML treeview in depth, which means the child, then the grandchild, ... until a leaf is reached. When the leaf is reached, the loop goes to the next child.
Minimum required version
  • Version 23
This page is also available for…
Comments
Click [Add] to post a comment