473,773 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display XML Data in ASPX

Hi, I want to display some pretty basic xml data in
a .NET user control that I would like to build for my
site.

I am getting the XML from a URL that has been provided to
me (i.e. http://domain.com/somelink.asp). If I type the
URL into my browser, the xml doc below is displayed. How
can I incorporate the XML into the user control so that I
can display the company name on my web page?

The XML doc looks like this:
<companies>
<company ID="1" Name="ABC Company"/>
<company ID="2" Name="XYZ Company"/>
<companies>

Thanks for your help.
Nov 19 '05 #1
3 1946
Probably the easy way is to load into DataSet using ReadXml method and bind
the DataSet to the user control.

"Michelle" wrote:
Hi, I want to display some pretty basic xml data in
a .NET user control that I would like to build for my
site.

I am getting the XML from a URL that has been provided to
me (i.e. http://domain.com/somelink.asp). If I type the
URL into my browser, the xml doc below is displayed. How
can I incorporate the XML into the user control so that I
can display the company name on my web page?

The XML doc looks like this:
<companies>
<company ID="1" Name="ABC Company"/>
<company ID="2" Name="XYZ Company"/>
<companies>

Thanks for your help.

Nov 19 '05 #2
Michelle,

Try using the System.Web.UI.W ebControls.Xml control. Drop the control onto
your web form or user control and set the "DocumentSource " to the url of your
xml data. Then set the "TransformSourc e" property to the url of an XSLT file.
When you run your page the Xml control will perform a transformation and
display your xml data. I've written a simple XSLT sample here that you can
test with:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">

<xsl:template match="/companies/company">
<table border="1">
<tr>
<td>
<xsl:value-of select="@Name" />
</td>
</tr>
</table>
</xsl:template>

</xsl:stylesheet>

The XSLT transform above will produce an HTML table that displays the
company name on separate rows as shown below:

ABC Company
XYZ Company

HTH,
Jorge

"Michelle" wrote:
Hi, I want to display some pretty basic xml data in
a .NET user control that I would like to build for my
site.

I am getting the XML from a URL that has been provided to
me (i.e. http://domain.com/somelink.asp). If I type the
URL into my browser, the xml doc below is displayed. How
can I incorporate the XML into the user control so that I
can display the company name on my web page?

The XML doc looks like this:
<companies>
<company ID="1" Name="ABC Company"/>
<company ID="2" Name="XYZ Company"/>
<companies>

Thanks for your help.

Nov 19 '05 #3
Thanks Jorge, That's what I started working with. The
problem is it seems like the xml web control only allows
document sources relative to the website itself. I am
trying to access http://somesite/getcompanies.asp to
return my xml doc. I get an error:

"Invalid Map Path... A virtual path is expected"

I can't believe I am not able to retrieve an xml document
from another site. Is that true?

-----Original Message-----
Michelle,

Try using the System.Web.UI.W ebControls.Xml control. Drop the control ontoyour web form or user control and set the "DocumentSource " to the url of yourxml data. Then set the "TransformSourc e" property to the url of an XSLT file. When you run your page the Xml control will perform a transformation anddisplay your xml data. I've written a simple XSLT sample here that you cantest with:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:styleshee t version="1.0"
xmlns:xsl="htt p://www.w3.org/1999/XSL/Transform">

<xsl:templat e match="/companies/company">
<table border="1">
<tr>
<td>
<xsl:value-of select="@Name" />
</td>
</tr>
</table>
</xsl:template>

</xsl:stylesheet>

The XSLT transform above will produce an HTML table that displays thecompany name on separate rows as shown below:

ABC Company
XYZ Company

HTH,
Jorge

"Michelle" wrote:
Hi, I want to display some pretty basic xml data in
a .NET user control that I would like to build for my
site.

I am getting the XML from a URL that has been provided to me (i.e. http://domain.com/somelink.asp). If I type the URL into my browser, the xml doc below is displayed. How can I incorporate the XML into the user control so that I can display the company name on my web page?

The XML doc looks like this:
<companies>
<company ID="1" Name="ABC Company"/>
<company ID="2" Name="XYZ Company"/>
<companies>

Thanks for your help.

.

Nov 19 '05 #4

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

Similar topics

0
1778
by: Ben | last post by:
Hi, Can you display data, for example datagrid, in a "Formatted Excel Form" dynamically? I mean the data in datagrid will be display on the webpage as Full Formatted Excel like frame, different font styles, formatted column header, colors... Please show me how or any information related. Thank you,
6
1167
by: Mike | last post by:
I need to display data in text boxes not datagrid, can anyone point to some examples on how this is done in VB.NET? in the old way it was <input type="text" value=<% dataitem %> > how can i do this in the .net world from db connection to populating the text boxes .net
2
3100
by: Joe | last post by:
Hi, I have an asp.net script that connects to MS Access database and displays data in a table. For some reason I am do not know how to display data say in ascending order of column1. I have pasted below the script that I am using. I will appreciate if someone can give me a clue as how to sort data in ascending or descending order when displaying on the page.
1
1265
by: basulasz | last post by:
May be it is a bit easy question but i don't know the way to display data in bounded colums. I get data from DB with a datareader, and I want to display them on bounded colums. I dont want to create colums dynamically. How can I do that? -- No Sign
5
2185
by: yma | last post by:
Hello, I tried to display a column in MS Access 2000 nwind.mdb using 3 data controls. But I got "It is already opened exclusively by another user, or you need permission to view its data." I put ole DataAdapter, Connection and dataset controls and fill in the properties of the listbox. The only code I have is OleDbDataAdapter1.Fill(DataSet11, "employees") in page_load sub.
1
1366
by: anoop | last post by:
hello, how can I display data from a Data source such as SQL Server in a textbox by using the click of a Button on an .aspx page in a Visual Basic ..Net Project . If I have to use a DataSet, then how, please explain step by step, I am new to .Net. I am using my own database in SQL Server, with all the tables created. Thank You
4
2070
by: seth_hickel | last post by:
With other solutions I would get a recordset, read each record and display data by formating my html as I wanted to display values of each record. I am trying to display data in a three column three row table with paging. How does this translate to ASP.NET - or - what ASP.NET tools do I use to accomplish this and how. Thank you.
1
1431
by: geeteshss | last post by:
First i would like to thank those persons who helped me out in solving my earlier problems the present problem is that i am unable to display data in datagrid....... but the data is visible in database..below is the code private void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { BindData(); }
7
1945
by: nma | last post by:
Hi I'm trying to display data in a table list format but error message like this appear. What is wrong with the code? "Parse error: syntax error, unexpected '<' in C:\htdocs\...\MB2movieinfo.php on line 27" I'm trying to display data from table in databse in new window and there is a close window button to close the opened window. TQ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
4
1793
by: JuAn2226 | last post by:
Hi, can anyone help me . when my program starts there is numbers and time will be display in the form of visual basic. it will run continuesly .My problem here is i dont know how to display the data 5min and before. Besides that i want to store this display for every 5 min and before. i already have database to store the number and time but not for every 5 min.should i create another database that just store data for 5min before. i already have...
0
9621
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
9454
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,...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
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
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
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
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2852
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.