Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select and copy parts of a string
#6
your syntax was not correct
Function Function4
Code:
Copy      Help
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


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)