473,799 Members | 3,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying XML

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">&nbsp;</td>
<td bgcolor="#fcedd 9">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
------------------------------------------------------------------------------------

If anyone know how to do this, I would love to hear abot it :-)

Best regards,
Christopher Brandsdal
Oct 17 '06 #1
1 1125
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'>&nbsp;" & vbCrLf)

Response.Write( "</td>" & vbCrLf)

Response.Write( "<td bgcolor='#fcedd 9'>&nbsp;</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">&nbsp;</td>
<td bgcolor="#fcedd 9">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
------------------------------------------------------------------------------------

If anyone know how to do this, I would love to hear abot it :-)

Best regards,
Christopher Brandsdal

Oct 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2470
by: Waguih Boctor | last post by:
Hi, I have a number of ASP pages where some JPGs and GIFs are displaying in the browser and some are not. I have included an excerpt from the HTML below. In this example, the gif file at the bottom of the example is displaying (I have others that don't), while the jpg file at the top isn't. Both files are in the same folder (visible bith physical in WE and virtual in CM) as the asp file itself. WHen not displaying, it displays instead...
8
5800
by: euang | last post by:
Hi, I have been using access 2000 for two years on WINDOWS NT to display dynamic aweb page using ASP My ISP has now changed to Windows 2003, and I am having major problems displaying information from MEMO fields within the Access 2000 database. I have not had any problems before displaying MEMO fields on NT and have tried various tips to resolve this issue but no luck so far. I was wondering if anyone had come accross a similar...
1
508
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time store in the database. However asp recognizes the data type as date and displays the date instead of the time. If I change the data type in mysql to varchar then asp will display the time correctly, but I cannot do it this way. I want to be able...
2
2864
by: Joe Price | last post by:
Hi chaps I've got an XML file, within that file i've embedded html code using the <!]> tag I'm displaying that xml file through a browser using an xsl style sheet. However it is displaying any html from the xml file as text, ie its displaying as text <br/> and <b> etc
1
2273
by: Yoshitha | last post by:
hi I have datalist control in my ASP.NET application the problem here is i have used a textbox with multiline true propertly when i enter data like "fdjsfhjksdhfjsdfhsdjhfsdfhsdjfhsd jfdsjfksdjfksdjkfjsdfjksdjfsdjfd fdsfhjsdhfjsdhfjf dsjf dsjfhjsdfhjksdh d fdsjf hsdjkfhdjsfhsdjfh ds
2
3451
by: Carole MacDonald | last post by:
There have been lots of posts on this topic, but I haven't been able to apply any of the suggestions to my situation. I have an .aspx page with a form on it that has several submit buttons on it. Clicking a button will cause a web service action that returns XML. I would like to display this XML response on the page with the form. I know I can display XML in an IFRAME by pointing its source to an XML file. But I'm streaming the XML...
5
2226
by: Robert | last post by:
Hello Accessors I have some reports created in Access that are very good for what they do. However, it seems to me that when you are displaying information you don't need to print out that a printer-friendly report is not the best way to go. So, I tried converting one of my Access reports to an Access form. I selected the continuous view to allow displaying multple records but when I went to define my sorting and grouping there was none...
2
4366
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event raised in the 'Handle Postback Events' stage of the control execution life cycle (via the...
0
1212
by: dipper | last post by:
I have a dataset with several tables. Now i want to create different dataviews displaying results from some of the tables. I manage to create a view displaying 1 table, but how do i create a view displaying multiple tables? Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **...
33
5566
by: buss123 | last post by:
Hi all, combo box script code was working in IE perfectly with all modes but OnChange event was not working in FireFox(editable mode, if we select valuese that combo box values r not dislaying if enter the data the it is inserting properly) javascript code follows pls help me to solve this problem function fnKeyDownHandler(getdropdown, e) { fnSanityCheck(getdropdown);
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.