CrazyPandar / marknote

Automatically exported from code.google.com/p/marknote
0 stars 0 forks source link

Incorrect handling of single quotes within CDATA #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to parse an XML file that contains a single quote / apostrophe 
within the CDATA, eg 
http://open.live.bbc.co.uk/weather/feeds/en/6943075/3dayforecast.rss (note the 
apostrophe in "St Martin's")

What is the expected output? What do you see instead?
Expect to see the XML parsed properly. Get an error.

What version of the product are you using? On what operating system?
Current version, on Ubuntu

Please provide any additional information below.
The attached patch seems to resolve the issue.

Original issue reported on code.google.com by tipich...@googlemail.com on 15 Jun 2014 at 8:10

Attachments:

GoogleCodeExporter commented 9 years ago
I have probably used the term CDATA incorrectly here. The problem is with 
apostrophes which occur within elements, but outside of tags. Outside tags only 
< and & have special meanings, even > is permitted (though it's probably not a 
great idea to use it).

Original comment by tipich...@googlemail.com on 15 Jun 2014 at 9:08

GoogleCodeExporter commented 9 years ago
The problem is with " also.

Original comment by boades....@gmail.com on 2 Dec 2014 at 4:39

GoogleCodeExporter commented 9 years ago
yep the " in the setText is killing the remainder of the output. 
need some escaping? 

Original comment by abyrne.s...@gmail.com on 4 Apr 2015 at 4:00

GoogleCodeExporter commented 9 years ago
Yes the problem is that the parser can't handle apostrophes inside tags.

For example (Note the apostrophe in Peter's):

var parser = new marknote.Parser();
var doc = parser.parse(
                    '<books>' + 
                       '<book>' + "Peter's diary" + '</book>' + 
                       '<book>' + "Javascript for beginners" + '</book>' +
                    '</books>');
alert(doc.toString());
Returns:
<books />

Consclusion: something went wrong while parsing.

I would certainly use this library but this bug prevents me from using it.

Original comment by altugtek...@gmail.com on 19 Jun 2015 at 10:36