Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Changing data or comparing data when using SelectNodes

From: David Knighton <davidandaprilknighton@-----.--->
To: 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!


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent