Jump to content

tbresson

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by tbresson

  1. I've solved the problemIf anyone wants to know:Before the loop I did this:NewEntry = falseFirstLine = trueThe very first entry of the XML file is called "fname":select case objLst.item(i).nodeName case "fname" if FirstLine = false then NewEntry = true end if FirstLine = falseAfter the end select I did this:if (i = objLst.length-1) then NewEntry = trueend ifif NewEntry = true then ' a whole "unit" of the XML file is not collected -> do stuff NewEntry = falseend if
  2. I am not able to change the content of the XML format. The file is supplied to me and is not changeable.Also it's a valid XML format according to W3, so I can't complain about that.
  3. Hi.I'm trying to make a small script that parses through an XML file. I don't have a lot of experience with XML but I managed to create a script (ASP) where I can access the contents of the XML file like this: Set objXML = Server.CreateObject("Microsoft.XMLDOM")objXML.async = false objXML.load(source) Set objLst = objXML.getElementsByTagName("*")For i = 0 to (objLst.length-1)select case objLst.item(i).nodeName ' CODE HEREend selectSet objXML = nothing Now. The content of the XML apparently does not contain blank nodes if the values are non-existing. Like this: (Madonna doesn't have a lastname (lname)). <person> <fname>Allan</fname> <lname>Rogers</lname> <fname>Madonna</fname> <fname>Peter</fname> <lname>Smith</lname></person> While looping through the content of the XML file I want to know when I have a complete set of information about ONE person, and the use that information to select against a database to compare info.But I can't tell when a new persons info. ends if the last node is not the same everytime.So I tried looking for fname, if I hit fname that meant that all info. had been gathered about ONE person. But then the last "unit" wouldn't get collected since there's no <fname> before </person>. For that I tried finding some sort of EOF property for XML but didn't suceeded. I did try using objLst.length to determine if I was at the end of the XML file, but apparently it doesn't take the very last node with it.If my code is placed in the top of the code around the first tag, it doesn't reach the last nodes and if the code is placed after collecting all nodes I can't look the next new "person" by fname.Perhaps I'm doing this all wrong, so I'd appreciate if someone have any ideas on how to proceed.
×
×
  • Create New...