Hello all,
I have an XmlException being thrown trying to use XslCompiledTransform while
using the google api. My suspicion is there is some html decoding happening
that I want to prevent...
something like this
><a href="http://news.google.com/news/url?sa=T&ct=us/2i-0&fd=A&url=http://www.
boston.com/news/nation/washington/articles/2008/02/26/senate_advances_bill_to_cu
t_war_funding&cid=1137103998&ei=Q77ER6-vMY7eqgPA1vGqAQ"><img
being changed into this
><a href="http://news.google.com/news/url?sa=T&ct=us/2i-0&fd=A&url=http://www.boston.com/n
ews/nation/washington/articles/2008/02/26/senate_advances_bill_to_cut_war_fundin
g&cid=1137103998&ei=Q77ER6-vMY7eqgPA1vGqAQ"><img
here is the code being used...
XmlReaderSettings readerSettings = new XmlReaderSettings();
//works fine when using this ATOM 1.0//
XmlReader reader =
XmlReader.Create("http://www.nfl.com/rss/rsslanding?searchString=home",
readerSettings);
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(@"C:\\myformat.xslt");
StringWriter writer = new StringWriter();
transform.Transform(reader, null, writer);
mydataset.ReadXml(new StringReader(writer.ToString()));
//xmlexception using results from google api//
XmlReader reader =
XmlReader.Create("http://www.google.com/reader/atom/feed/http%3A%2F%2Fnews.google.com%2Fnews", readerSettings);
If anyone has run across this, any help would be appreciated.
Robert - 28 Feb 2008 17:16 GMT
hehe..the post decoded too :)
here is the error...$exception {"The 'a' start tag on line 65 does not match
the end tag of 'img'. Line 70, position 5."} System.Exception
{System.Xml.XmlException}
here is the intended value for the BEFORE
&.g.t.;.&.l.t.;a
href="http://news.google.com/news/url?sa=T&.a.m.p.;.amp;ct=us/2i-0&.a.m.p.;amp;fd=A&.a
.m.p.;amp;url=http://www.boston.com/news/nation/washington/articles/2008/02/26/s
enate_advances_bill_to_cut_war_funding&.a.m.p.;amp;cid=1137103998&.a.m.p.;amp;ei
=Q77ER6-vMY7eqgPA1vGqAQ"&.g.t.;&.l.t.;img
> Hello all,
>
[quoted text clipped - 28 lines]
>
> If anyone has run across this, any help would be appreciated.
Martin Honnen - 28 Feb 2008 18:13 GMT
> I have an XmlException being thrown trying to use XslCompiledTransform while
> using the google api.
XmlExceptions are usually thrown by XmlReader when the markup it is
trying to parse is not well-formed XML. I don't think it has anything to
do with XslCompiledTransform.

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Robert - 28 Feb 2008 19:05 GMT
That makes since. So how can the decoding of HTML be prevented when using
XmlReader?
> > I have an XmlException being thrown trying to use XslCompiledTransform while
> > using the google api.
>
> XmlExceptions are usually thrown by XmlReader when the markup it is
> trying to parse is not well-formed XML. I don't think it has anything to
> do with XslCompiledTransform.
Robert - 28 Feb 2008 20:31 GMT
The issue was during testing I was logged into Google, but when using the API
programmatically you must perform authentication. Otherwise the response is
an HTML page not the expected XML feed data.
> That makes since. So how can the decoding of HTML be prevented when using
> XmlReader?
[quoted text clipped - 5 lines]
> > trying to parse is not well-formed XML. I don't think it has anything to
> > do with XslCompiledTransform.
Martin Honnen - 29 Feb 2008 13:05 GMT
> That makes since. So how can the decoding of HTML be prevented when using
> XmlReader?
I don't understand. I said XmlReader throws an exception when the markup
it is trying to parse is not well-formed. So make sure you use XmlReader
to parse XML and not HTML.

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/