Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Changing data or comparing data when using SelectNodes [Thread Next] Re: Changing data or comparing data when using SelectNodesTo: NULL Date: 8/3/2004 3:25:00 AM From my code
First I read the XML data using SelectNodes:
Dim bLoadResult
bLoadResult = objXMLDoc.load(Server.MapPath("hostdata.xml"))
'If Load successful
If bLoadResult Then
'Generate HTML Output
'Select Site Nodes
'Dim siteNodes
Set siteNodes = objXMLDoc.selectNodes("/entry/*[starts-with(name(),
'from')]")
Dim Node
yy = 1
For Each Node In siteNodes
response.write(Node.text & "<br>")
' results(yy) = node.text
yy=yy+1
Next
Response.Write "</ul>"
Else
'Load Unsuccessful, print error
Response.Write "<font color='red'>" & objXMLDoc.parseError.reason &
"</font>"
End If
'end of code
Then I want to compare it to a specific field in a form entry:
'comparison code below
key1 = request.form.key(x+1)
key2 = "from"
response.write (key1 & " " & key2 & " ")
if InStr (1,key1,key2,1)>0 then
makestring = (Request.Form(x+1))
'If makestring = "" Then
'x=x+incrs
'if x > Request.Form.count then
'x=Request.Form.count
'end if
'response.write("match detected - only host data will change ")
'else
'response.write("no match detected - all data changes ")
'response.write(makestring & " ")
'end if
'commented out 7/24 until I figure out how to make it compare properly
If makestring = "" Then
response.write (makestring & " ")
x=x+incrs
if x > Request.Form.count then
x=Request.Form.count
end if
response.write("match detected - only host data will change 2 ")
else
response.write("no match detected - all data changes 2 ")
end if
end if
end if
'code ends here
Obviously, the makestring value is meant to be compared to the xml
counterpart from SelectNodes using the array feature of that command,
Node(1), Node(2) etc. I don't have the counter installed to increment
that number, but since my testing has given me "type mismatch" each
time, I didn't see the need for further testing.
Why on earth would a command such as SelectNodes exist if there's no way
to convert the data or compare it to another value. Other than display,
I think the command is useless.
Anyone know a way to transpose the data? Like a CInt function for
conversion to integer? Node2String? If I can get this to eliminate the
extra entries, then the database would be a lot cleaner. Might also
help out others who are doing single user style entries, to prevent
multiple identical records.
Thanks again. This message board rocks.
David
David Knighton
I'm not an expert, I just dabble and occasionally rewrite code I find on
the Net to my needs.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
