You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Matthias Baldauf <ma...@gmx.at> on 2006/09/07 10:48:44 UTC
Comment-bug in the Batik Parser?
Hi,
I am using the Batik parser and the JXCSS SAX adapter
to generate a well-formed XML-file out of an CSS-file.
(Batik v1.6, JXCSS 1.0, SAC v1.3 and the runtime environment JDK 1.4)
First, for understanding the problem,
here an example (a simple StyleSheet and the resulting XML-Document):
body {
border: 0px;
}
/* a comment after the body-selector */
<css-stylesheet>
<style>
<element-node-selector local-name="body" namespace-uri="" />
<property name="border">
<value type="float" unit="px">0.0</value>
</property>
<comment>a comment after the body-selector</comment>
</style>
</css-stylesheet>
As you can see: the comment directly after the body-rule is appended
after the last property-element in the previous style-element in the XML-File.
The SACDocumentHandler() calls the method comment() before
the method endElement() for the Style.
Comments inside a style-rule will be appended correctly,
only comments after a style-rule are making problems.
Are there any intentions to fix this problem?
Thanks!
Matthias
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Comment-bug in the Batik Parser?
Posted by th...@kodak.com.
Hi Matthias,
"Matthias Baldauf" <ma...@gmx.at> wrote on 09/07/2006 04:48:44 AM:
> As you can see: the comment directly after the body-rule is appended
> after the last property-element in the previous style-element in the
XML-File.
> The SACDocumentHandler() calls the method comment() before
> the method endElement() for the Style.
This is a risky bug to fix as it is caused by the design
of the CSS parser. Our CSS parser is designed such that each
'document element' sets up the next important lexical
unit. So when the parseStyleDeclaration finds the
'RIGHT_CURLY_BRACE' it then calls nextIgnoreSpaces (which
also ignores comments - but notifies the handler). But
this happens before the caller can signal the end of X to
the document handler.
Now one can imagine moving the call to nextIgnorespaces
outside of the parseStyleDeclaration function but the
issue is that this bug is present in many places.
Trying to fix this would involve moving a lot of similar
code around, which is error prone.
> Are there any intentions to fix this problem?
I don't have any intention of fixing this right now.
Given that the bug is fairly benign (even in your
case it isn't _that_ bad), and the fact that it would
require fairly extensive testing (and test code) to
ensure that the fix didn't break anything else, I
just can't justify putting in my time.
I would suggest filing a bugzilla bug report.
Also I will subtly hint that patch contributions are
always welcome.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org