dimanche 7 juin 2015

Batch Program IF THEN help needed

I have an XML file to read, and certain nodes I already have parsed. Here is an example:

 <goingTo>RNS</goingTo>
 <goingTo>HTY</goingTo>

The cmd code to extract from the XML file looks like this:

 for /F "tokens=3 delims=<>" %%i in ('findstr "<goingTo>" AST.xml') do echo %%i >>To_Places.txt

This all works fine, with a result of:

RNS
HTY 

in my To_Places.txt file.

Also in my XML I am trying to parse and add conditional statements, but I am having a hard time with that.

In my XML file I have to iterate through the file to check if something is loaded or empty.

A snippet of the node in XML:

 <VehWeight>14.878</VehWeight>
 <VehWeight>4.98</VeWeight>

I need the batch code to look through the XML file, read the VehWeight data and execute GTR 14 = Load or LSS 14 = MTY. Then have this output to a text file appended to the To_Places.txt file.

Is there such a way in batch?

Aucun commentaire:

Enregistrer un commentaire