473,659 Members | 2,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp:Xml control and Xml output

I am attempting to construct a simple ASP.NET Rss/Xml newsfeed. If anyone
has visited Don Box's Blog (http://www.gotdotnet.com/team/dbox/), you will
notice that his Rss feed is exposed through an ASP.NET page. When you load
the .aspx page in IE, it displays just as an Xml doc would (colored nodes,
expandable node heirarchy, etc.).

I would like to mimic this using the <asp:Xml /> server control and pumping
the Xml to it from a CodeBehind XmlDocument(), but for now I am just
stuffing the Xml into the control manually for testing:

<asp:Xml runat="server">
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Rss Feed</title>
<link>http://localhost/rss/</link>
<copyright>Copy right (c)</copyright>
<item>
<title>Empty Title</title>
<guid>Empty GUID</guid>
<link>Empty Link</link>
<pubDate>Empt y Date</pubDate>
<description>Te st Rss Xml Feed</description>
<body xmlns="http://www.w3.org/1999/xhtml">
Test
</body>
</item>
</channel>
</rss>
</asp:Xml>

When I try to load any Xml from the .aspx page, it just concatenates the
data in all nodes into one huge string, but viewing the source shows the Xml
just as I want it. This behavior even continues if all I do is load the
straight Xml into the .aspx page without the <asp:Xml /> server control. The
only conclusion I can come to is that this a mime-type issue, or I need an
XSLT stylesheet applyed to the Xml (but I am see that as the less likely
issue).

Never done much with Xml in ASP.NET, so sorry if this is elementary. TIA.
Grant Harmeyer
Nov 18 '05 #1
1 1500
You need to set the ContentType property of the HttpResponse object to be of
type "text/xml" in order for the client to know what it is that you are
writing to it. Additionally, you don't need to wrap what you are writing
inside of a System.Web.UI.W ebControls.Xml object, unless you need to
manipulate it. Whatever literal text you include in your aspx page will be
compiled as an object of type System.Web.UI.W ebControls.Lite ral and fed
directly to the client, so you aren't gaining anything by doing that for
literal text.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Grant Harmeyer" <gn*********@ho tmail.com> wrote in message
news:u4******** ******@TK2MSFTN GP10.phx.gbl...
I am attempting to construct a simple ASP.NET Rss/Xml newsfeed. If anyone
has visited Don Box's Blog (http://www.gotdotnet.com/team/dbox/), you will
notice that his Rss feed is exposed through an ASP.NET page. When you load
the .aspx page in IE, it displays just as an Xml doc would (colored nodes,
expandable node heirarchy, etc.).

I would like to mimic this using the <asp:Xml /> server control and
pumping
the Xml to it from a CodeBehind XmlDocument(), but for now I am just
stuffing the Xml into the control manually for testing:

<asp:Xml runat="server">
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Rss Feed</title>
<link>http://localhost/rss/</link>
<copyright>Copy right (c)</copyright>
<item>
<title>Empty Title</title>
<guid>Empty GUID</guid>
<link>Empty Link</link>
<pubDate>Empt y Date</pubDate>
<description>Te st Rss Xml Feed</description>
<body xmlns="http://www.w3.org/1999/xhtml">
Test
</body>
</item>
</channel>
</rss>
</asp:Xml>

When I try to load any Xml from the .aspx page, it just concatenates the
data in all nodes into one huge string, but viewing the source shows the
Xml
just as I want it. This behavior even continues if all I do is load the
straight Xml into the .aspx page without the <asp:Xml /> server control.
The
only conclusion I can come to is that this a mime-type issue, or I need an
XSLT stylesheet applyed to the Xml (but I am see that as the less likely
issue).

Never done much with Xml in ASP.NET, so sorry if this is elementary. TIA.
Grant Harmeyer

Nov 18 '05 #2

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

Similar topics

4
4800
by: Paul | last post by:
Hi all. This one is really getting to me now, I'm using the <asp:xml web server control and I'm trying to use the XsltArgument list to add a custom class so that I can do some formatting in the XSL style sheet. however each time it complains that the prefix "util" could not be found, any ideas???????? bloody thing is driving me mad code snippet:
1
1295
by: Greg Collins [MVP] | last post by:
I've got a web site I've built that uses an InfoPath form to generate an xml file. This file is then transformed within the default.aspx page to create the contents of the page. The problem I'm running into is that I need to be able to return more ASP.NET code as part of the return value of the <asp:Xml/> call, but it does not get processed at this point. The call: <asp:Xml id="myXml" runat="server" DocumentSource="myFile.xml"...
0
1197
by: Random | last post by:
I would like to be able to read an Xml file with an <asp:Xml> Web Control and using XSLT dynamically write <asp:Xml> Web Controls to the page using the information from the first Xml file, which would in turn perform their own transform based on existing xml and xslt files. As another way of accomplishing my goal, I was thinking I could have a dataset tied to a repeater or table control that would write out the <asp:Xml> controls for...
1
1219
by: Danny Ni | last post by:
Hi, I use the <asp:xml> control, xml and xslt to generate a HTML for users to input data, here is my HTML snippet in a web form: <asp:Xml id="Xml1" runat="server" TransformSource="entry.xsl" DocumentSource="data.xml"></asp:Xml> The form display correctly in the browser, the question is, how do I get the values users input?
1
1123
by: Monster | last post by:
When <asp:xml is included in the aspx page, the source page contains this line "<?xml version="1.0" encoding="utf-8"?>" which shouldn't be in the html file.
0
904
by: msnews.microsoft.com | last post by:
Hello I am using ASP:XML with a web control... which in turns pulls XML from SQL server and later does the transformation... /***/ this.l__obj__XML.Document = // XML result set from SQL server - String this.l__obj__XML.Transform = //XSLT - pointer a file on a local drive
0
941
by: mareal | last post by:
I am using the ASP:XML control to format XML data into HTML (thru XSLT). This works great so far. During the transformation, I am creating a table with links (<a>). I need to give these links a unique ID and I can't find a way to do this. Any ideas? Finally, I need to be able to debug the HTML output from the ASP:XML control. Every time I do View->Source, I am able to see the HTML code for the page and NOT the ASP:XML control. What do...
0
1127
by: Will Chamberlain | last post by:
Before I start let me clarify that an XmlDataSource will not work for what I am doing. I am attempting to recreate a .NET version of binding Xml Data Islands to HTML Tables in IE 5.x+. You could easily use an Xml File as DSO and bind to an HTML table, easy. The reason an XmlDataSource doesn't work is because the Xml file isn't downloaded to the client. For my program to work, I need that since I am doing drag and drop and appending...
1
1229
by: mweb72 | last post by:
Hi all, I have a strong problem in asp/xml, i think it's a little thing but hard to find... Then, i get an xml file, it contain 3 childsnodes as product, and many items into. But, i can't ready more than one childnodes, explanations : My code : Set objHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0") objHTTP.open...
0
8332
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
8851
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
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8525
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,...
1
6179
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
5649
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
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
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
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.