Help - Search - Members - Calendar
Full Version: how to glean a line from an xml doc
MSFN Forums > Coding, Scripting and Servers > Programming (C++, Delphi, VB, etc.)

   


Google Internet Forums Unattended CD/DVD Guide
aspenjim
I have been working on a batch file to keep antivirus def's up to date for CLI scanning. I've managed to get the info in a couple of xml files, but need to glean one line in each of them and insert the text into my batch file...

CODE
  <?xml version="1.0" encoding="ISO-8859-1" ?>
- <response>
- <return>
  <code>0</code>
  <desc>Valid key</desc>
  </return>
- <servers>
  <item weight="10">srv3.directupdates.f-prot.net</item>
  <item weight="1">files.directupdates.f-prot.net</item>
  </servers>
- <components>
- <item type="deffile">
  <name>antivir.def</name>
  <path>/files/defs/v.6/20090724-1439-9c1722e1078540975dd26505a1e775f8/antivir.def</path>
- <uniqid>
  <item type="defid">200907241350b1f2eda5b9dce3692bea07b283f093ef</item>
  <item type="md5">3adf20033f9d7654d1de9fca2a365e64</item>
  <item type="sha1">d8fe7d15f9534ceb31f84083a02c2c34f5b5e34c</item>
  <item type="size">40361941</item>
  </uniqid>
  </item>
  </components>
  <programversion />
  <timestamp utime="1248474272">2009-06-24 22:24:32</timestamp>
  </response>


In this case, I want this line...

CODE
/files/defs/v.6/20090724-1439-9c1722e1078540975dd26505a1e775f8/antivir.def


to be concatenated to my batch file as it changes every day.

Would someone mind making a suggestion as to how I can accomplish this?

TIA.. aj

jcarle
Any reason why it has to be a batch file? Perhaps you could write something simple using VBScript instead?
aspenjim
Cuz I don't know VB. I can barely do a batch script with download.exe and wget.exe. They work great though for what I need. I've had one that I've tweaked for years now.

I don't know how to start learning how to make VB scripts but am willing to learn.

Thanks...

btw i think i used your batch script once upon a time to download windows updates.
Yzöwl
QUOTE (aspenjim @ Jul 30 2009, 03:31 PM) *
I have been working on a batch file to keep antivirus def's up to date for CLI scanning. I've managed to get the info in a couple of xml files, but need to glean one line in each of them and insert the text into my batch file...

CODE
@For /f "tokens=3 delims=<>" %%# In ('Find "<path>"^<your.xml') Do @Echo %%#
Change your.xml to the proper name and Echo to whatever you need to do with your content %%#.




Google Internet Forums Unattended CD/DVD Guide

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.