07-30-2012, 02:25 AM
Path() does not support this. When it finds first <SubFolders>, it gets all its children <Folder> and does not search for other <SubFolders>. Standard XPath probably would get all, but QM supports XPath only partially.
In this case need 2 loops.
Macro Macro1797
In this case need 2 loops.
Macro Macro1797
str sXml=
;<?xml version = "1.0"?>
;<Folder-list>
,;<Folder>
,,;<SubFolders>
,,,;<Folder>
,,,,;<Expanded>False1b</Expanded>
,,,,;<Snippets></Snippets>
,,,,;<Title>sub1</Title>
,,,;</Folder>
,,;</SubFolders>
,,;<Title>mainfolder-1</Title>
,;</Folder>
,;<Folder>
,,;<SubFolders>
,,,;<Folder>
,,,,;<Expanded>False2b</Expanded>
,,,,;<Snippets></Snippets>
,,,,;<Title>sub2</Title>
,,,;</Folder>
,,;</SubFolders>
,,;<Title>mainfolder-2</Title>
,;</Folder>
;</Folder-list>
IXml x=CreateXml
x.FromString(sXml)
ARRAY(IXmlNode) b c
;------cycle path-------------
x.Path("/Folder-list/Folder" b)
;------cycle path-------------
int i j
for i 0 b.len
,str titlecheck=b[i].ChildValue("Title")
,if(!empty(titlecheck))
,,out(titlecheck)
,b[i].Path("SubFolders/Folder" c)
,for j 0 c.len
,,titlecheck=c[j].ChildValue("Title")
,,if(!empty(titlecheck))
,,,out(titlecheck)
,,