03-30-2017, 01:48 PM
If I want to count the amount of <Pair> nodes within <FolderPairs> in the below example, how do I use the 'Count()' (If applicable in this example). I got 'Count' from the helpfile:
Below I used .len and it returns 2 which is seems correct as <FolderPairs> has 2 x child nodes: <Pair>...</Pair>
Is this correct? in other words: Can I use .len If I specified x.Path correctly?:
FreeFileSync/MainConfig/FolderPairs/* (see below in example).
To avoid confusion, I want to count how many times <Pair>...</Pair> occurs.
Macro xml - count nodes - example 1
Below I used .len and it returns 2 which is seems correct as <FolderPairs> has 2 x child nodes: <Pair>...</Pair>
Is this correct? in other words: Can I use .len If I specified x.Path correctly?:
FreeFileSync/MainConfig/FolderPairs/* (see below in example).
To avoid confusion, I want to count how many times <Pair>...</Pair> occurs.
Macro xml - count nodes - example 1
;This example should output the <Pair> count under the parentnode <FolderPairs>
ARRAY(IXmlNode) a
str xml=
;<?xml version="1.0" encoding="UTF-8"?>
;<FreeFileSync XmlFormat="6" XmlType="GUI">
;;;;;<MainConfig>
;;;;;;;;;<FolderPairs>
;;;;;;;;;;;;;<Pair>
;;;;;;;;;;;;;;;;;<Left>c:\doc</Left>
;;;;;;;;;;;;;;;;;<Right>d:\doc</Right>
;;;;;;;;;;;;;</Pair>
;;;;;;;;;;;;;<Pair>
;;;;;;;;;;;;;;;;;<Left>c:\music</Left>
;;;;;;;;;;;;;;;;;<Right>d:\music</Right>
;;;;;;;;;;;;;</Pair>
;;;;;;;;;</FolderPairs>
;;;;;;;;;<OnCompletion/>
;;;;;</MainConfig>
;;;;;<GuiConfig>
;;;;;;;;;<HandleError>Popup</HandleError>
;;;;;;;;;<MiddleGridView>Action</MiddleGridView>
;;;;;</GuiConfig>
;</FreeFileSync>
IXml x._create
IXmlNode e
x.FromString(xml)
int i
e=x.Path("FreeFileSync/MainConfig/FolderPairs/*" a 1)
out a.len ;; Using '.len' to count the CHILD nodes from '<FolderPairs>'