Menu

#171 xml-stylesheets PI

open
None
5
2007-02-01
2007-02-01
No

I had to switch off some error checking in sgmlparser.tcl to allow for xml-stylesheet PI. Not sure what the standard says.

# Mats: to allow for "<?xml-stylesheet type='text/xsl' href='log.xsl'?>"
} elseif {0 && [regexp {[xX][mM][lL]} $tag]} {
uplevel #0 $options(-errorcommand) [list illegalcharacters "characters \"xml\" not permitted in processing instruction target \"$tag\""]

Discussion

  • James Armstrong

    James Armstrong - 2008-12-05

    Between Version 1.30 and 1.31 the anchors for the regular expression testing for a processing instruction like <?xml?> on line 627 were removed. This causes the test to reject xml-stylesheet Processing Instructions. Although this seems to be a closer match to the error message: "characters "XML" not permitted in processing instruction target ...." It is a stronger test than called for by the standard. (http://www.w3.org/TR/1998/REC-xml-19980210#sec-pi)
    From that document the formulation: "[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) " just says the PITarget must be a name but not "XML" in any combination of upper or lower case. Contrast that with the rule just above it [16] that states that if any characters appear between the PITarget and the closing "?>" those characters can't include "?>". See: http://www.w3.org/TR/xml-stylesheet/ for the legitimacy of the xml-stylesheet Processing Instruction. Since the parser logic already handles <?xml ... ?> just prior to this test to exclude "XML" as a PI Target this is dead code at best. But since a lot of RSS feeds do use xml-stylesheet it would be a good idea to either remove this test as Mat's patch effectively does or restore the anchors that were present in the 1.30 version.

     
  • Jasper

    Jasper - 2010-05-27

    I am having to hack the parser to fix this in my application

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.