From: SourceForge.net <no...@so...> - 2010-05-18 07:30:07
|
Plugin Bugs item #2064591, was opened at 2008-08-21 07:36 Message generated for change (Comment added) made by hunteke You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=565475&aid=2064591&group_id=588 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Kevin Hunter (hunteke) Assigned to: Eric Le Lay (kerik-sf) Summary: XML plugin auto closes incorrect tag Initial Comment: jEdit (r13380), XML v2.0.9 With the attached file, when I try to close the '<head>' tag by typing '</', it closes the '<script>' tag on Line 7 instead. It's reading the '<script>' tags inside of the strings, which is incorrect. ---------------------------------------------------------------------- >Comment By: Kevin Hunter (hunteke) Date: 2010-05-18 03:30 Message: I apologize for forgetting to get back on this bug. I'm having a devil of a time tracking down the report now, or even a reference, but I have a recollection that my original assumption was incorrect. I recall pointing out this "error" to the W3 folks (or someone), and was informed that my formulation was actually incorrect. XML parsers correctly ignore the semantics that we humans assign to quotes. Thus, to do this type of document morphing, one needs to encode the left chevron ('<'). See attached file for one possible solution. (For completeness, I'll point out that I believe the style of building HTML fragments piecemeal via string operations like I was apparently doing in 2008 is frowned upon.) The point is that the XML or HTML plugin is actually performing the correct action. Caveat emptor: as I haven't thought about this is over 18 months, I'm not sure that my recollection or above analysis is correct. ---------------------------------------------------------------------- Comment By: Dale Anson (daleanson) Date: 2010-05-17 14:42 Message: Actually, the html sidekick delegates a lot to the xml sidekick. The problem seems to be in the XML sidekick code, specificially in xml.parser.TagParser.findStartTag(). This method just works backwards through the code until it finds a matching start tag and takes no account of the sidekick Asset, which gives the actual start and end of a tag. I'll attach an example xml file that demonstrates the problem. Open the file in jEdit, open Sidekick and be sure you're parsing it as xml. You'll see the same problem as with the html file. ---------------------------------------------------------------------- Comment By: Alan Ezust (ezust) Date: 2010-05-16 13:56 Message: I see everything works fine with the "html-compliant.html" test file, as long as I am parsing using the HTML parser. However, if I add the code that is indicated in the diff, then it seems the contents of the <script> </script> confuses the XML parser and makes it think there are a bunch of opened script tags that need to be closed. This might be a bug in the HTML sidekick parser part of the XML plugin. ---------------------------------------------------------------------- Comment By: Kevin Hunter (hunteke) Date: 2008-09-02 14:23 Message: Logged In: YES user_id=1271235 Originator: YES $ patch -o html_borked.html < html_diff.diff After applying this patch to the previous attachment (html_compliant.html), note that '</script>' tag on line 12 incorrectly matches a string on line 10. File Added: html_diff.diff ---------------------------------------------------------------------- Comment By: Kevin Hunter (hunteke) Date: 2008-09-02 13:58 Message: Logged In: YES user_id=1271235 Originator: YES Alright, I'll buy that it's not a valid XML document. However, I'll also point out that it's been useful to me in an HTML role as well. As, for instance, auto closing tags, showing me matching tags, and enabling folds. To be fair, I'll point out that the engine at http://validator.w3.org/ has a similar problem. I will attach the file in two parts, for playing purposes. A base correct HTML document (but not XML), and a udiff to make it not work. File Added: html_compliant.html ---------------------------------------------------------------------- Comment By: Matthieu Casanova (kpouer) Date: 2008-09-02 11:10 Message: Logged In: YES user_id=285591 Originator: NO Hi, that's nice, the problem is that you html document is not a valid xml document You could put your javascript code in xml comments, I think it will still work, and will also fix the problem. I don't know if it is possible to fix that in the XML plugin, but wait for Alan's answer ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=565475&aid=2064591&group_id=588 |