Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
read xml convert to folder/subfolder/text file
#6
Sorry to bother you again, I really am but this very simple problem is beating me up ( I tried different approaches using the helpfile and xml discussions on forum).
The following example works perfect to extract "mainfolder-1" and "mainfolder-2", they both get printed out in the "out" window.

Macro Macro
Code:
Copy      Help
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

;------cycle path-------------
x.Path("/Folder-list/Folder" b)
;------cycle path-------------

int i
for i 0 b.len
,str titlecheck=b[i].ChildValue("Title")
,,if (!empty(titlecheck))
,,,,out(titlecheck)

But when I want to extract the "sub1" and "sub2", it doesn't work. What I mean is, only 1 gets printed out in the "out" window => "sub1".
Not "sub1" and "sub2". The method I used is by altering:

Macro Macro
Code:
Copy      Help
;------cycle path-------------
x.Path("/Folder-list/Folder" b)
;------cycle path-------------

to

Macro Macro
Code:
Copy      Help
;------cycle path-------------
x.Path("/Folder-list/Folder/SubFolders/Folder" b)
;------cycle path-------------


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)