Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > General Computer Support > dataset reading XML error...

Reply
Thread Tools

dataset reading XML error...

 
 
OhioHoya OhioHoya is offline
Junior Member
Join Date: Apr 2010
Posts: 1
 
      04-26-2010
Okay - this is driving me crazy because I really need to get this working and have not been able to find the solution. Here is my setup:

1. I have an aspx page that simply generates an xml output stream. Code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Clear()
Response.ClearHeaders()
Response.ContentType = "text/xml"
Response.ContentEncoding = Encoding.UTF8

Dim xtwFeed As New XmlTextWriter(Response.OutputStream, Encoding.UTF

With xtwFeed
' Start the document
.WriteStartDocument()

'Do a sql data read and loop here. (will hard-code for now)
.WriteStartElement("News")
.WriteStartElement("NewsItem")
.WriteElementString("NewsID", "1")
.WriteElementString("Title", "Hobbits")
.WriteElementString("Image", "hobbits.jpg")
.WriteElementString("Text", "Hobbits fuel record DVD sales")
.WriteEndElement()

.WriteStartElement("NewsItem")
.WriteElementString("NewsID", "2")
.WriteElementString("Title", "Net favorite")
.WriteElementString("Image", "towers.jpg")
.WriteElementString("Text", "Online critics reward Two Towers")
.WriteEndElement()

.WriteStartElement("NewsItem")
.WriteElementString("NewsID", "3")
.WriteElementString("Title", "Here to stay")
.WriteElementString("Image", "cd.jpg")
.WriteElementString("Text", "Industry boss warning on illegal music")
.WriteEndElement()

.WriteStartElement("NewsItem")
.WriteElementString("NewsID", "4")
.WriteElementString("Title", "Eye spy")
.WriteElementString("Image", "Eye.jpg")
.WriteElementString("Text", "Pupils to be eye scanned at school")
.WriteEndElement()

' Close all tags
.WriteEndElement() ' News
.WriteEndDocument() ' Document
.Flush()
.Close()
End With
Response.End()

End Sub

2. The html code on this page is:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="NewsFeed.aspx.vb" Inherits="NewsFeed" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">

<html>
<head id="Head1" runat="server">

<title>Untitled Page</title>
</head>
<body>

<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>


3. The page that should be reading this xml stream has the following code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim ds As New System.Data.DataSet

ds.ReadXml("NewsFeed.aspx") ' <=== The following error happens here:
'Exception Details: System.Xml.XmlException: Name cannot begin with the '%' character, hexadecimal value 0x25. Line 2, position 2.

'(more code here but doesn't have anything to do with the error)

End Sub


Okay, I think I've tried almost every combination in changing these files. I have deleted the <html>, <head> and <body> tag areas. I have moved code around like crazy but still nothing works. If I call the xml (aspx) page in a browser it looks to work just fine. I have not moved this code to an actual web server - I have only been running this via dev. This shouldn't be an issue because I have a copy of xml output in a separate file called newsfeed.xml which works just fine on the dataset loadxml method. It just seems that I can't get rid of some prefix that is being sent when the NewsFeed.aspx page is called...

Can someone please help? I know this must be a simple thing to do and maybe I'm having a brain fart on this but I can't keep losing precious days of development on this problem.

Thanks, in advance, for the help!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading an XML string into a dataset Maziar Aflatoun ASP .Net 1 08-21-2005 05:02 PM
Dataset>XML>SQLText field>XML>Dataset thomas@humphries.com ASP .Net 0 07-12-2005 03:52 AM
Reading an XML file into a dataset Maziar Aflatoun ASP .Net 1 03-14-2005 10:19 PM
dataset.Databind error when dataset XML contains attributes... ringo ASP .Net Datagrid Control 0 08-18-2004 05:28 PM
Validating XML types before (as) Reading into Dataset Earl Teigrob ASP .Net 0 04-29-2004 10:30 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57