473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why I get an error when displaying a XML file?

Hello,

How to load a XML document and display it immediately after in the
browser?

Dim doc As New System.Xml.XmlDocument
doc.Load("~/XMLFile.xml")
Context.Response.ContentType = "text/xml; charset=utf-8"
Context.Response.Write(siteMap)

I tried this but I am getting a parser error:
XML Parsing Error: syntax error
Location: http://localhost:2736/GaragemRamos%202006a/_Lab.aspx
Line Number 1, Column 1:System.Xml.XmlDocument
^

This is very strange because I can't see any error in my XML sample
file:

<?xml version="1.0" encoding="utf-8" ?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>two of our famous Belgian Waffles with plenty of real
maple syrup</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>light Belgian waffles covered with strawberries and
whipped cream</description>
<calories>900</calories>
</food>
</breakfast_menu>

Thanks,
Miguel

Nov 7 '06 #1
3 1320
It looks good...

Maybe you can try to Response.Clear() before sending anything out and making
sure to Response.End() after so nothing else gets added to the output
stream...

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"shapper" <md*****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hello,

How to load a XML document and display it immediately after in the
browser?

Dim doc As New System.Xml.XmlDocument
doc.Load("~/XMLFile.xml")
Context.Response.ContentType = "text/xml; charset=utf-8"
Context.Response.Write(siteMap)

I tried this but I am getting a parser error:
XML Parsing Error: syntax error
Location: http://localhost:2736/GaragemRamos%202006a/_Lab.aspx
Line Number 1, Column 1:System.Xml.XmlDocument
^

This is very strange because I can't see any error in my XML sample
file:

<?xml version="1.0" encoding="utf-8" ?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>two of our famous Belgian Waffles with plenty of real
maple syrup</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>light Belgian waffles covered with strawberries and
whipped cream</description>
<calories>900</calories>
</food>
</breakfast_menu>

Thanks,
Miguel

Nov 7 '06 #2
Hi,

I solved it using your sugestion and changing the last code line to:
Context.Response.Write(siteMap.OuterXml)

Thanks,
Miguel

Karl Seguin [MVP] wrote:
It looks good...

Maybe you can try to Response.Clear() before sending anything out and making
sure to Response.End() after so nothing else gets added to the output
stream...

Karl

--
http://www.openmymind.net/
http://www.codebetter.com/
"shapper" <md*****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hello,

How to load a XML document and display it immediately after in the
browser?

Dim doc As New System.Xml.XmlDocument
doc.Load("~/XMLFile.xml")
Context.Response.ContentType = "text/xml; charset=utf-8"
Context.Response.Write(siteMap)

I tried this but I am getting a parser error:
XML Parsing Error: syntax error
Location: http://localhost:2736/GaragemRamos%202006a/_Lab.aspx
Line Number 1, Column 1:System.Xml.XmlDocument
^

This is very strange because I can't see any error in my XML sample
file:

<?xml version="1.0" encoding="utf-8" ?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>two of our famous Belgian Waffles with plenty of real
maple syrup</description>
<calories>650</calories>
</food>
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>light Belgian waffles covered with strawberries and
whipped cream</description>
<calories>900</calories>
</food>
</breakfast_menu>

Thanks,
Miguel
Nov 7 '06 #3
Hi Miguel,

You are sending some values as regular response either before or after
writing the xml.
You need to close the response with Context.Response.End() after writing
the xml, and maybe also Context.Response.Clear() before you write the xml.
--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 7 '06 #4

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

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
2
by: Randy Harris | last post by:
I thought that I had a grasp of how VBA error handling functioned, but have just become painfully aware that I don't. I thought that the "On Error GoTo 0" in the second sub below would turn off...
1
by: Amar | last post by:
I have set the file size limit to 50 MB in the Machine.config file on the websever. whenever a user tries to upload a file which has size > 50 MB, then my application quits showing a DNS error...
25
by: moondaddy | last post by:
I have an application where users need to upload images and in my web.config file I have a setting like this: <httpRuntime maxRequestLength="512" /> Which restricts image larger than 500k from...
2
by: Alex Nitulescu | last post by:
Hi. I have created a web-based "file manager", for remote-administration of a web-site. It works okay. The "main" form in the "file manager" is BrowseFiles.aspx. I can edit the text files (among...
0
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or...
1
by: asad | last post by:
hello how ru all, i have some problem in displaying xml file in asp.net, i successfully create an xml file but when want to display it through ASP.NET code it throwing following error. ...
4
by: junaidnaseer | last post by:
Hi ! I am facing a problem that I have defined a function which when called in the same file generates an error as follows; " visual c error C2371 redefinition basic types see...
0
by: jmawebco | last post by:
I have a project I'm working on in VS2005 using vb.net with a MSSql 2005 backend. Everytime I try to run the application I get the same error message; ********* ERROR ********* Compilation...
6
by: suresh_nsnguys | last post by:
Hi, This is my first message to this forum.I am facing one problem in frames.when i am trying to access child frame from parent frame i am getting "Access Denied Error".i know the reason bcz i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...

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.