|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Decoding questionstring 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 ? 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 ? > > Ciaran O'Donnell wrote:
Show quoteHide quote > I get the impression the first line with the XML declaration is ignored and The Rows is closed - just missed that in the snippet - sorry!> 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 ? > > > > Try replacing S&P with S&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 ? > GTi,
The first error that I get is for using the &. You should use & instead. The second error is for not closed <rows> tag. When I fixed bot problems the XML showed up. -- Show quoteHide quoteHTH Stoitcho Goutsev (100) "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 ? > |
|||||||||||||||||||||||