Home All Groups Group Topic Archive Search About
Author
8 Sep 2006 8:22 AM
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 ?

Author
8 Sep 2006 9:01 AM
Ciaran O'Donnell
I get the impression the first line with the XML declaration is ignored and
the problem is that you dont close the <rows> element.

HTH

Ciaran O'Donnell

Show quoteHide quote
"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 ?
>
>
Are all your drivers up to date? click for free checkup

Author
8 Sep 2006 11:30 AM
GTi
Ciaran O'Donnell wrote:
Show quoteHide quote
> I get the impression the first line with the XML declaration is ignored and
> the problem is that you dont close the <rows> element.
>
> 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!
Author
8 Sep 2006 1:27 PM
S Kachru
Try replacing S&P with S&amp;P



Show quoteHide quote
> 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 ?
>
Author
8 Sep 2006 2:23 PM
Stoitcho Goutsev (100)
GTi,

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

The second error is for not closed <rows> tag.

When I fixed bot problems the XML showed up.


--
HTH
Stoitcho Goutsev (100)

Show quoteHide quote
"GTi" <tun***@gmail.com> wrote in message
news:1157703724.000018.113080@m79g2000cwm.googlegroups.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 ?
>



Post Thread options