473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XslCompiledTransform? possible problem with html decoding

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_cut_war_funding&amp;cid=11 37103998&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/news/nation/washington/articles/2008/02/26/senate_advances_bill_to_cut_war_funding&amp;cid=11 37103998&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.
Feb 28 '08 #1
5 2824
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/senate_advances_bill_to_cut_war_funding&.a.m.p.;am p;cid=1137103998&.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 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_cut_war_funding&cid=113710 3998&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_war_funding&cid=113710 3998&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.
Feb 28 '08 #2
Robert wrote:
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.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 28 '08 #3
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 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.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 28 '08 #4
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.

"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 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.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 28 '08 #5
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
http://JavaScript.FAQTs.com/
Feb 29 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve | last post by:
Using VB.NET 2.0 I have a simple routine that attempts transforms an XmlDocument with an XSLT stylesheet into HTML. Under the old 1.1 framework with XslTransform, everything worked fine. Now...
1
by: S. David Kyle | last post by:
I am having a weird issue when I generate an input Html tag from a Xsl transformation. When the trasform is executed on the xsl below, the <inputtag has the closing slash removed in the first...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
1
by: mikepmyers | last post by:
I've done some research online and turned up with results that did not sit well with me. I’m using the System.Xml.XslCompiledTransform class as recommended by MS; however, it’s creating self-closing...
1
by: Hans Kesting | last post by:
Hi, In our ASP.Net webapplications, we use xslt a lot. For 1.1 developing was "easy": start up the website and go to the page where the xslt was used. Change the xslt (save it) and refresh the...
1
by: Mark | last post by:
I'm getting the error "The URI scheme is too long." in the code below. What is URI in this context? The XSL or the XML being transformed? Thanks! -Mark StringBuilder sb = new...
3
by: Andy Fish | last post by:
Hi, From reading the documentation, I get the impression that XslCompiledTransform should be faster than XslTransform on my test with a large complex document and a large complex XSLT, the...
1
by: mcfly1204 | last post by:
I have a method that converts an Xml file to HTML using XslCompiledTransform. After the HTML file is created, I pass a variable holding the path and name of the HTML file to another method that is...
2
by: steve.nickels | last post by:
Hello. I'm in the midst of moving a web application from ASP.NET 1.1 to ASP.NET 2.0 (framework 3.0), and as part of this move, I am told by Visual Studio that the XslTransform object is now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.