I turned my head around, and came up with something that worked great.
Might not be the best code LOL ;-)
<%@ Import Namespace="Syst em.Xml" %>
<script language="VB" runat=server>
sub Page_Load(Sende r as Object, e as EventArgs)
dim reader as XMLTextReader
Response.Write( "<table width='360' border='0' cellspacing='0'
cellpadding='0' >")
try
reader = New
XmlTextReader(" http://www.telenor.tur npike.no/voting/rakfiskfestival/public/status.xml")
While reader.Read()
Select Case reader.NodeType
Case XMLNodeType.Ele ment
if reader.HasAttri butes then
If reader.Attribut eCount = 2 Then
Else
If reader.GetAttri bute(0) = "none" Then
Else
Response.Write( "<tr>" & vbCrLf)
Response.Write( "<td width='115' height='25'>" & vbCrLf)
Response.Write( "<strong>" & vbCrLf)
Select Case reader.GetAttri bute(0)
Case "1"
Response.Write( "example 1" & vbCrLf)
Case "2"
Response.Write( "example 2" & vbCrLf)
Case Else
Response.Write( "default example" & vbCrLf)
End Select
Response.Write( "</strong>" & vbCrLf)
Response.Write( "</td>" & vbCrLf)
Response.Write( "<td width='50' height='25'>" & vbCrLf)
Response.Write( "<em>" & vbCrLf)
Response.Write( reader.GetAttri bute(1))
Response.Write( "</em>" & vbCrLf)
Response.Write( "</td>" & vbCrLf)
Response.Write( "<td width='195' height='25'>" & vbCrLf)
Response.Write( "<table width='195' height='12' border='0' cellpadding='0'
cellspacing='0' >" & vbCrLf)
Response.Write( "<tr>" & vbCrLf)
Response.Write( "<td width='" & reader.GetAttri bute(2) & "'
bgcolor='#b4003 c'> " & vbCrLf)
Response.Write( "</td>" & vbCrLf)
Response.Write( "<td bgcolor='#fcedd 9'> </td>" & vbCrLf)
Response.Write( "</tr>" & vbCrLf)
Response.Write( "</table>" & vbCrLf)
Response.Write( "</td>" & vbCrLf)
Response.Write( "</tr>" & vbCrLf)
End If
End If
End If
End Select
End While
catch ex as Exception
Response.Write( "Error accessing XML file")
finally
reader.close
end try
Response.Write( "</table>")
end sub
</script>
<html><body>
</body></html>
"Christophe r Brandsdal" <br*******@bina er.noskrev i melding
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi!
I have problems displaying a XML-file the way i want on my website.
This is the link to the file I have to display(ps: the file is on a remote
server, so I have to the file via http or something):
http://www.telenor.turnpike.no/votin...lic/status.xml
I want to display the data in my own designed HTML-code. One of the big
challanges to insert the "percent" field in the XML-file into the
width="x%" field in the HTML TD.
I have tried XSLT and lots of other things in VS2005, but I can't seem to
fin any solutin. This might be easy, but I'm a newb to XML ;-)
Here is the HTML-code i want the XML data to be inserted into:
(The fields from the XML-file is marked ### FieldName ###)
------------------------------------------------------------------------------------
<table width="360" border="0" cellspacing="0" cellpadding="0" >
<tr>
<td width="115" height="25"><st rong>### id ###</strong></td>
<td width="50" height="25"><em >(### count ###)</em></td>
<td width="195" height="25"><ta ble width="195" height="12" border="0"
cellpadding="0" cellspacing="0" >
<tr>
<td width="### percent ###" bgcolor="#b4003 c"> </td>
<td bgcolor="#fcedd 9"> </td>
</tr>
</table></td>
</tr>
</table>
------------------------------------------------------------------------------------
If anyone know how to do this, I would love to hear abot it :-)
Best regards,
Christopher Brandsdal