MSFN Forums: how to glean a line from an xml doc - MSFN Forums

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

how to glean a line from an xml doc Rate Topic: -----

#1 User is offline   aspenjim 

  • Member
  • PipPip
  • Group: Members
  • Posts: 152
  • Joined: 09-April 05

Post icon  Posted 30 July 2009 - 08:31 AM

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...

  <?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...

/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

Ad Bot #1 User is online   Sponsor Icon

  • Advert Bot
  • Group: Ad Bots
  • Posts: 0
  • Joined: --

Warn Status

Warning level: 0%

0
  • +
  • -

#2 User is offline   jcarle 

  • MSFN Master
  • Icon
  • Group: Developers
  • Posts: 2,540
  • Joined: 14-August 04
  • Gender:Male
  • Location:Joliette, QC

Posted 01 August 2009 - 12:21 AM

Any reason why it has to be a batch file? Perhaps you could write something simple using VBScript instead?

#3 User is offline   aspenjim 

  • Member
  • PipPip
  • Group: Members
  • Posts: 152
  • Joined: 09-April 05

Posted 04 August 2009 - 04:49 PM

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.

#4 User is offline   Yzöwl 

  • Wise Owl
  • Icon
  • Group: Super Moderator
  • Posts: 3,638
  • Joined: 13-October 04
  • Gender:Male
  • OS:Vista Home Premium x86
  • Location:Cumbria
  • Country: Country Flag

Posted 04 August 2009 - 05:48 PM

View Postaspenjim, on Jul 30 2009, 03:31 PM, said:

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...

@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 %%#.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users