XslCompiledTransform? possible problem with html decoding

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?Um9iZXJ0?=

    XslCompiledTransform? possible problem with html decoding

    Hello all,

    I have an XmlException being thrown trying to use XslCompiledTran sform 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_cut_wa r_funding&amp;c id=1137103998&a mp;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/news/nation/washington/articles/2008/02/26/senate_advances _bill_to_cut_wa r_funding&amp;c id=1137103998&e i=Q77ER6-vMY7eqgPA1vGqAQ "><img
    here is the code being used...

    XmlReaderSettin gs readerSettings = new XmlReaderSettin gs();
    //works fine when using this ATOM 1.0//
    XmlReader reader =
    XmlReader.Creat e("http://www.nfl.com/rss/rsslanding?sear chString=home",
    readerSettings) ;
    XslCompiledTran sform transform = new XslCompiledTran sform();
    transform.Load( @"C:\\myformat. xslt");
    StringWriter writer = new StringWriter();
    transform.Trans form(reader, null, writer);
    mydataset.ReadX ml(new StringReader(wr iter.ToString() ));

    //xmlexception using results from google api//
    XmlReader reader =
    XmlReader.Creat e("http://www.google.com/reader/atom/feed/http%3A%2F%2Fne ws.google.com%2 Fnews", readerSettings) ;

    If anyone has run across this, any help would be appreciated.
  • =?Utf-8?B?Um9iZXJ0?=

    #2
    RE: XslCompiledTran sform? possible problem with html decoding

    hehe..the post decoded too :)

    here is the error...$except ion {"The 'a' start tag on line 65 does not match
    the end tag of 'img'. Line 70, position 5."} System.Exceptio n
    {System.Xml.Xml Exception}
    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;f d=A&.a.m.p.;amp ;url=http://www.boston.com/news/nation/washington/articles/2008/02/26/senate_advances _bill_to_cut_wa r_funding&.a.m. p.;amp;cid=1137 103998&.a.m.p.; amp;ei=Q77ER6-vMY7eqgPA1vGqAQ "&.g.t.;&.l.t.; img


    "Robert" wrote:
    Hello all,
    >
    I have an XmlException being thrown trying to use XslCompiledTran sform 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_cut_wa r_funding&cid=1 137103998&ei=Q7 7ER6-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/news/nation/washington/articles/2008/02/26/senate_advances _bill_to_cut_wa r_funding&cid=1 137103998&ei=Q7 7ER6-vMY7eqgPA1vGqAQ "><img
    >
    here is the code being used...
    >
    XmlReaderSettin gs readerSettings = new XmlReaderSettin gs();
    //works fine when using this ATOM 1.0//
    XmlReader reader =
    XmlReader.Creat e("http://www.nfl.com/rss/rsslanding?sear chString=home",
    readerSettings) ;
    XslCompiledTran sform transform = new XslCompiledTran sform();
    transform.Load( @"C:\\myformat. xslt");
    StringWriter writer = new StringWriter();
    transform.Trans form(reader, null, writer);
    mydataset.ReadX ml(new StringReader(wr iter.ToString() ));
    >
    //xmlexception using results from google api//
    XmlReader reader =
    XmlReader.Creat e("http://www.google.com/reader/atom/feed/http%3A%2F%2Fne ws.google.com%2 Fnews", readerSettings) ;
    >
    If anyone has run across this, any help would be appreciated.

    Comment

    • Martin Honnen

      #3
      Re: XslCompiledTran sform? possible problem with html decoding

      Robert wrote:
      I have an XmlException being thrown trying to use XslCompiledTran sform 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 XslCompiledTran sform.


      --

      Martin Honnen --- MVP XML

      Comment

      • =?Utf-8?B?Um9iZXJ0?=

        #4
        Re: XslCompiledTran sform? possible problem with html decoding

        That makes since. So how can the decoding of HTML be prevented when using
        XmlReader?

        "Martin Honnen" wrote:
        Robert wrote:
        >
        I have an XmlException being thrown trying to use XslCompiledTran sform 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 XslCompiledTran sform.
        >
        >
        --
        >
        Martin Honnen --- MVP XML

        >

        Comment

        • =?Utf-8?B?Um9iZXJ0?=

          #5
          Re: XslCompiledTran sform? possible problem with html decoding

          The issue was during testing I was logged into Google, but when using the API
          programmaticall y you must perform authentication. Otherwise the response is
          an HTML page not the expected XML feed data.

          "Robert" wrote:
          That makes since. So how can the decoding of HTML be prevented when using
          XmlReader?
          >
          "Martin Honnen" wrote:
          >
          Robert wrote:
          I have an XmlException being thrown trying to use XslCompiledTran sform 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 XslCompiledTran sform.


          --

          Martin Honnen --- MVP XML

          Comment

          • Martin Honnen

            #6
            Re: XslCompiledTran sform? possible problem with html decoding

            Robert wrote:
            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.

            --

            Martin Honnen --- MVP XML

            Comment

            Working...