02-04-2017, 02:41 AM
I have the below XML in the xml string "xml_str"
I have a problem generating a desired result which is explained below in the green comment.
Macro Macro6
Above in the green commented code you see what I want to achieve.
I have a problem generating a desired result which is explained below in the green comment.
Macro Macro6
str xml_str=
;<?xml version="1.0" encoding="UTF-8" ?>
;<FreeFileSync XmlFormat="6" XmlType="BATCH">
,;<MainConfig>
,,;<Comparison>
,,,;<Variant>TimeAndSize</Variant>
,,,;<Symlinks>Exclude</Symlinks>
,,,;<IgnoreTimeShift />
,,;</Comparison>
,,;<SyncConfig>
,,,;<Variant>Mirror</Variant>
,,,;<CustomDirections>
,,,,;<LeftOnly>right</LeftOnly>
,,,,;<Conflict>none</Conflict>
,,,;</CustomDirections>
,,,;<DetectMovedFiles>false</DetectMovedFiles>
,,,;<DeletionPolicy>Permanent</DeletionPolicy>
,,,;<VersioningFolder Style="Replace" />
,,;</SyncConfig>
,,;<GlobalFilter>
,,,;<Include>
,,,,;<Item>*</Item>
,,,;</Include>
,,,;<Exclude>
,,,,;<Item>\System Volume Information\</Item>
,,,;</Exclude>
,,,;<TimeSpan Type="None">0</TimeSpan>
,,,;<SizeMin Unit="None">0</SizeMin>
,,,;<SizeMax Unit="None">0</SizeMax>
,,;</GlobalFilter>
,,;<FolderPairs>
,,,;<Pair>
,,,,;<Left>d:\test</Left>
,,,,;<Right>z:\test</Right>
,,,;</Pair>
,,;</FolderPairs>
,,;<OnCompletion />
,;</MainConfig>
,;<BatchConfig>
,,;<HandleError>Ignore</HandleError>
,,;<RunMinimized>false</RunMinimized>
,,;<LogfileFolder Limit="0" />
,;</BatchConfig>
;</FreeFileSync>
ARRAY(IXmlNode) ax
IXml x._create
IXmlNode e
int i
x.FromString(xml_str)
e=x.Path("/FreeFileSync/MainConfig/FolderPairs" ax 1)
e.Add("Pair" "").Add("Left" "L")
e.Add("Pair" "").Add("Right" "R") ;; <==== second subnode, but does NOT generate desired result
;;......................
;Actual result:
;<Pair>
,;<Left>L</Left>
;</Pair>
;<Pair>
,;<Right>R</Right>
;</Pair>
;;......................
;Desired result: <<==================================
;<Pair>
,;<Left>d:\test</Left>
,;<Right>z:\test</Right>
;</Pair>
;<Pair>
,;<Left>L</Left>
,;<Right>R</Right>
;</Pair>
;;......................
x.ToString(_s)
out _s
Above in the green commented code you see what I want to achieve.