vb.net - How to read multiple xml elements from a file? -


hi have xml document , want extract either first or second applications file path , file name etc. ive tried

documentelement.selectsinglenode("/installerlist/installer/file_path").innertext 

but ever first applications info , never second, ive tried playing around

documentelement.selectnodes("//installer") 

and adding integer end of cycle through doesnt seem that. thoughts?

<?xml version="1.0" encoding="utf-8"?> <installerlist>  <installer name="first application">    <filepath>c:\</filepath>    <third_parameter>etc</third_parameter>    <forth_parameter>etc</forth_parameter>  </installer>  <installer name="second application">    <filepath>etc</filepath>    <third_parameter>etc</third_parameter>    <forth_parameter>etc</forth_parameter>  </installer> </installerlist> 

if want select single filepath element, given known key value, such installer's name attribute, can add condition xpath narrow results, this:

documentelement.selectsinglenode("/installerlist/installer[@name='first application']/filepath").innertext 

or, can select of filepath elements, , loop through them, this:

for each node xmlnode in documentelement.selectnodes("/installerlist/installer/filepath")     dim path string = node.innertext     ' ... next 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

python - cx_oracle unable to find Oracle Client -