473,385 Members | 1,753 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,385 software developers and data experts.

Decoding question

GTi
I have this snippet function:
string buf = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rows>\n";
buf += "<row id=\"1\">\n";
buf += "<cell>2</cell>\n";
buf += "<cell>S&P 11</cell>\n";
buf += "</row>\n";

Page.Response.Clear();
Page.Response.ContentType = "text/xml";
Page.Response.Write(buf);
Page.Response.BufferOutput = true;
Page.Response.Expires = 0;
Page.Response.End();

This one gived me a nice error message in the browser:
XML Parsing Error: not well-formed
Location: http://127.0.0.1/xmfile.aspx?DoGenerateXmlFile=1
Line Number 4, Column 10:<cell>S&P 11</cell>

I know this is the most common xml error, but how can I avoid this?
How can I force the output to be UTF-8 encoded ?

Sep 8 '06 #1
4 1444
I get the impression the first line with the XML declaration is ignored and
the problem is that you dont close the <rowselement.

HTH

Ciaran O'Donnell

"GTi" wrote:
I have this snippet function:
string buf = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rows>\n";
buf += "<row id=\"1\">\n";
buf += "<cell>2</cell>\n";
buf += "<cell>S&P 11</cell>\n";
buf += "</row>\n";

Page.Response.Clear();
Page.Response.ContentType = "text/xml";
Page.Response.Write(buf);
Page.Response.BufferOutput = true;
Page.Response.Expires = 0;
Page.Response.End();

This one gived me a nice error message in the browser:
XML Parsing Error: not well-formed
Location: http://127.0.0.1/xmfile.aspx?DoGenerateXmlFile=1
Line Number 4, Column 10:<cell>S&P 11</cell>

I know this is the most common xml error, but how can I avoid this?
How can I force the output to be UTF-8 encoded ?

Sep 8 '06 #2
GTi
Ciaran O'Donnell wrote:
I get the impression the first line with the XML declaration is ignored and
the problem is that you dont close the <rowselement.

HTH

Ciaran O'Donnell

"GTi" wrote:
I have this snippet function:
string buf = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rows>\n";
buf += "<row id=\"1\">\n";
buf += "<cell>2</cell>\n";
buf += "<cell>S&P 11</cell>\n";
buf += "</row>\n";

Page.Response.Clear();
Page.Response.ContentType = "text/xml";
Page.Response.Write(buf);
Page.Response.BufferOutput = true;
Page.Response.Expires = 0;
Page.Response.End();

This one gived me a nice error message in the browser:
XML Parsing Error: not well-formed
Location: http://127.0.0.1/xmfile.aspx?DoGenerateXmlFile=1
Line Number 4, Column 10:<cell>S&P 11</cell>

I know this is the most common xml error, but how can I avoid this?
How can I force the output to be UTF-8 encoded ?
The Rows is closed - just missed that in the snippet - sorry!

Sep 8 '06 #3
Try replacing S&P with S&amp;P
I have this snippet function:

string buf = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rows>\n";
buf += "<row id=\"1\">\n";
buf += "<cell>2</cell>\n";
buf += "<cell>S&P 11</cell>\n";
buf += "</row>\n";
Page.Response.Clear();
Page.Response.ContentType = "text/xml";
Page.Response.Write(buf);
Page.Response.BufferOutput = true;
Page.Response.Expires = 0;
Page.Response.End();
This one gived me a nice error message in the browser:
XML Parsing Error: not well-formed
Location: http://127.0.0.1/xmfile.aspx?DoGenerateXmlFile=1
Line Number 4, Column 10:<cell>S&P 11</cell>
I know this is the most common xml error, but how can I avoid this?
How can I force the output to be UTF-8 encoded ?

Sep 8 '06 #4
GTi,

The first error that I get is for using the &. You should use &amp; instead.

The second error is for not closed <rowstag.

When I fixed bot problems the XML showed up.
--
HTH
Stoitcho Goutsev (100)

"GTi" <tu****@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
>I have this snippet function:
string buf = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rows>\n";
buf += "<row id=\"1\">\n";
buf += "<cell>2</cell>\n";
buf += "<cell>S&P 11</cell>\n";
buf += "</row>\n";

Page.Response.Clear();
Page.Response.ContentType = "text/xml";
Page.Response.Write(buf);
Page.Response.BufferOutput = true;
Page.Response.Expires = 0;
Page.Response.End();

This one gived me a nice error message in the browser:
XML Parsing Error: not well-formed
Location: http://127.0.0.1/xmfile.aspx?DoGenerateXmlFile=1
Line Number 4, Column 10:<cell>S&P 11</cell>

I know this is the most common xml error, but how can I avoid this?
How can I force the output to be UTF-8 encoded ?

Sep 8 '06 #5

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

Similar topics

3
by: steve | last post by:
Hi, I am opening a stream that is UTF encoded. I use fgetc to read the stream- which is binary safe. I add every character read to a string. But when I look at the stream, I see some...
1
by: Thomas Williams | last post by:
Hello everyone, my name is Tom W. And, I am new to the list, and have been using Python for about a year now. Anyway, I got a question! I am trying to decode MIME (base64) email from a POP3...
40
by: Peter Row | last post by:
Hi all, Here is my problem: I have a SQL Server 2000 DB with various NVarChar, NText fields in its tables. For some stupid reason the data was inserted into these fields in UTF8 encoding. ...
0
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the...
5
by: Peter Jansson | last post by:
Hello group, The following code is an attempt to perform URL-decoding of URL-encoded string. Note that std::istringstream is used within the switch, within the loop. Three main issues have been...
14
by: BB | last post by:
Hello. i am trying to decode a block of (what i think is) base64 into text, and i have NO idea how to begin. I'm going to paste the whole string here, but i want to know the steps necessary to...
25
by: marcin.rzeznicki | last post by:
Hello everyone I've got a little problem with choosing the best decoding strategy for some nasty problem. I have to deal with very large files wich contain text encoded with various encodings....
9
by: KWSW | last post by:
Having settled the huffman encoding/decoding and channel modeling(thanks to the previous part on bitwise operation), the last part would be hamming encoding/decoding. Did some research as usual on...
0
by: Michele | last post by:
Hi there, I'm using a python script in conjunction with a JPype, to run java classes. So, here's the code: from jpype import * import os import random import math import sys
42
by: Santander | last post by:
how to decode HTML pages encoded like this: http://www.long2consulting.com/seeinaction2008/Simplicity_Beach_table/index.htm Is there script that will do this automatically and generate normal fully...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
0
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,...
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...

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.