Soon I will need to extract data from an XML file. These files will be in a directory on my server. Does anyone have any good tutorials on this? I've never dealt with XML before.
Thanks
Michael
Soon I will need to extract data from an XML file. These files will be in a directory on my server. Does anyone have any good tutorials on this? I've never dealt with XML before.
Thanks
Michael
Cander: got anything for using SAXXML (4.0) and loading all that into memory with the global.asa?
mmm no. A search on google didnt turn up anything relevant.
Try looking around at www.vbxml.com
perhaps you can find something there.
Thanks for that link. I also found this one to be helpful:
http://www.15seconds.com/issue/990527.htm
Michael
I am trying to do the example on the link I posted and failing miserabley... (i suck at spelling too) Is it me or the example that is not working?
thanks in advance,Code:<%
Option Explicit
Dim objXML
Dim objList
Dim intCount
Dim strDate
Set objXML = Server.CreateObject("Microsoft.XMLDOM")
Set objList = Server.CreateObject("Microsoft.XMLDOM")
objXML.async = False
objXML.Load (Server.MapPath("mostRecentScriptingNews.xml"))
Set objList = objXML.getElementsByTagName("*")
For intCount = 0 To (objList.length -1)
If objList.item(intCount).nodeName = "pubDate" Then
strDate = objList.item(intCount).text
Exit For
End If
Next
response.write ". " & strDate & " ."
%>
Michael
It was me :D ... aparently <Name> dosent match </name>
Michael
case sensitivity is a BIG gotcha in xml. gotta watch out for that. :D
Yea, I had read that when I first started looking into this project about a yr ago (yes, I am very backlogged :) ). I had to create a sample xml file from a hard copy because after a year I can no longer find my digital copy. I think I had 3 typos in the whole thing (not bad for 3 pages though :) )
Thanks
Michael
ps Know any good references for asp/xml DOM?
Thanks again
MS
Found a good one:
http://www.devguru.com/Technologies/...dom_index.html
but... I am trying to get the name of each node what is the ."thisthing" for that?
thanks
Michael
OK, here's my problem.
I want to dynamicly assign the name and the value in a for loop... I have this and it will work but I want better :)
VB Code:
Set objList = objXML.getElementsByTagName("*") For intCount = 0 To (objList.length -1) Response.write "<b>" & objList.item(intCount).nodeName & "</b><br>" Response.write objList.item(intCount).text & " " & intCount & "<br><br>" Next
But if I have this in the XML File:
I am only getting "NameFirst" when exicuting the nodeName... I may have another "NameFirst" (like under billing or something) so I want to get the names of the parent nodes as well or something to that effect...Code:<Guests>
<Guest>
<NameInfo>
<NameFirst>Daffy</NameFirst>
<NameLast>Duck</NameLast>
Any Ideas?
Thanks
Michael
you might want to look into using XSL to parse the XML into html. You can do that client AND server side which is cool. Go herre for more info
http://www.xmlfiles.com/xsl/
xsl provides looping and if statements so you get a lot flexability
The thing is that this won't be displayed in the browser and if so it is only on the sever so no one will see it (unless they are logged in looking at the server.
What I am doing is taking information form the XML file and 1) storing parts in the database 2) emailing parts various places. So I am trying to get the data from the XML to ASP variables.
Michael
ok I tried to do an:
In theroy I thought it would work but fo some reason it sees:VB Code:
Set objList = objXML.getElementsByTagName("*") For intCount = 0 To (objList.length -1) If objList.item(intCount).hasChildNodes Then 'do something Else 'write the value and the compunded name End If Next
<NameFirst>Daffy</NameFirst>
as having a child... what is dosen't see as having a child though is:
<Membership MemberType = "Mileage Plus" MemberNumber = "0033445689" MemberLevel = "Premier"/>
hmmm... any suggestions ideas or insight?
Thanks
Michael
Ok. I have it figured and working :)
what I did was strored the node names in an array as I went along and checked against the next node's parent to see if I incremented the array or went backwardds in the array ... confusing at first but worked like a charm :)
Michael