Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / February 2008

Tip: Looking for answers? Try searching our database.

XslCompiledTransform? possible problem with html decoding

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert - 28 Feb 2008 17:10 GMT
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&amp;ct=us/2i-0&amp;fd=A&amp;url=http://www.
boston.com/news/nation/washington/articles/2008/02/26/senate_advances_bill_to_cu
t_war_funding&amp;cid=1137103998&amp;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&amp;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/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.