03-08-2015, 02:59 PM
your syntax was not correct
Function Function4
Function Function4
str XML=
;<XML>
;;<Elements nextID="4">
;;;;<Element>
;;;;;;<ID>1</ID>
;;;;;;<Date>2015-03-05T14:33:48</Date>
;;;;;;<Name>File1</Name>
;;;;;;<Link>Link1</Link>
;;;;</Element>
;;;;<Element>
;;;;;;<ID>2</ID>
;;;;;;<Date>2015-03-05T14:33:48</Date>
;;;;;;<Name>File2</Name>
;;;;;;<Link>Link2</Link>
;;;;</Element>
;;;;<Element>
;;;;;;<ID>3</ID>
;;;;;;<Date>2015-03-05T14:33:48</Date>
;;;;;;<Name>File3</Name>
;;;;;;<Link>Link3</Link>
;;;;</Element>
;;</Elements>
;</XML>
str file="File1"
str ID
IXml x._create
x.FromString(XML)
IXmlNode n=x.RootElement.Path(F"Elements/Element[Name='{file}']/ID")
if(!n) end "not found"
ID=n.Value
out ID
file="File2"
n=x.RootElement.Path(F"Elements/Element[Name='{file}']/ID")
if(!n) end "not found"
ID=n.Value
out ID