Link to home
Start Free TrialLog in
Avatar of Nico2011
Nico2011Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Parsing XML VBScript

Hello,

I have an XML file which I'm trying to parse.  I get most of the data with no issues, but there is a sub array for images, which has 3 nodes, but my code isn't seperating the nodes, so I'm getting all the data in one long string - I need it seperated so I can add it to my DB...

The first part of the XML file is:
<?xml version="1.0" encoding="utf-8"?>
<result>
<HouseCode>AT-1010-04</HouseCode>
<Updated>2013-01-06T10:55:59-08:00</Updated>
<BasicInformationV3>
  <Name>Studio Wien Zentrum</Name>
  <MaxNumberOfPersons>2</MaxNumberOfPersons>
  <ExceedNumberOfBabies>0</ExceedNumberOfBabies>
  <NumberOfPets>3</NumberOfPets>
  <NumberOfStars>3</NumberOfStars>
  <DimensionM2>25</DimensionM2>
  <ZipPostalCode>1010</ZipPostalCode>
  <Country>AT</Country>
  <Region>NIE</Region>
  <CreationDate>2010-02-22</CreationDate>
  <WGS84Longitude>16.383728</WGS84Longitude>
  <WGS84Latitude>48.211055</WGS84Latitude>
  <OptionsAllowed>No</OptionsAllowed>
  <HolidayPark>at-1010-001</HolidayPark>
  <EnqeCount>6</EnqeCount>
  <EnqePoints>54</EnqePoints>
  <NumberOfBedrooms>0</NumberOfBedrooms>
  <NumberOfBathrooms>1</NumberOfBathrooms>
  <SkiArea/>
  <Brands>
    <element>
      <SequenceNumber>1</SequenceNumber>
      <Brand>BV</Brand>
    </element>
  </Brands>
</BasicInformationV3>
<MediaV1>
  <Photos>
    <Photo>
      <Tag>ExteriorSummer</Tag>
      <Height>500</Height>
      <URL>media.leisure-ict.net/photo/web/500/83583_lsr_20101213106909640392.jpg</URL>
    </Photo>
    <Photo>
      <Tag>ExteriorSummer</Tag>
      <Height>500</Height>
      <URL>media.leisure-ict.net/photo/web/500/83583_lsr_2010110252638872804.jpg</URL>
    </Photo>

Open in new window


and my code,which is within another array (of all the properties) is:
set images_list = itemAttrib.SelectNodes("MediaV1/*[starts-with(name(),'Photo')]")
    For Each i In images_list
	z = z + 1
    image = i.text
    	if image <> "" then
	imagename = right(image, (len(image) - len("http://media.leisure-ict.net/photo/web/")))
	response.Write(imagename & "<BR>")
    	end if
	response.Flush()
    next

Open in new window


And the output I get is:

t/photo/web/500/83583_lsr_20101213106909640392.jpg ExteriorSummer 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252638872804.jpg ExteriorSummer 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252568593389.jpg HallReception 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252815864325.jpg LivingRoom 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252896152910.jpg LivingRoom 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252881510637.jpg LivingRoom 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252850841576.jpg Kitchen 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252865548629.jpg Kitchen 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252914303597.jpg ParkFacilities 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252739056371.jpg ParkFacilities 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252765821198.jpg ParkFacilities 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252582697238.jpg ParkFacilities 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252779065199.jpg AreaSummer1KM 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252517689956.jpg AreaSummer1KM 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252697644269.jpg AreaSummer1KM 500 media.leisure-ict.net/photo/web/500/83583_lsr_2010110252601105859.jpg

Open in new window


It's also missing part of the first image filename, bu I do also want to be able t grab the description of each image, which is in the data above, but all bunched up!

Help appreciated - thanks!
ASKER CERTIFIED SOLUTION
Avatar of ltlbearand3
ltlbearand3
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nico2011

ASKER

That is PRECISELY what I needed - thank you so much Bear - works perfectly!