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 gurks <r....@gmx.at> on 2007/08/30 10:52:22 UTC

Parse exception on document reload

I use Batik in a RCP application. There is a very strange behaviour when
loading a document into a JSVGCanvas.

I use the SWT_AWT bridge which seems to work all fine. The JSVGCanvas is
embedded in an editor. First time I open the editor no problems appear. But
when I close the editor and reopen it (that means the SVG document should
also be reloaded) some parse exceptions like the following appear:

bundleentry://855/grafix/teeth.svg:
The attribute "style" represents an invalid CSS declaration
("fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.76020235px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;display:inline").
Original message:

or

bundleentry://855/grafix/teeth.svg:
The attribute "style" represents an invalid CSS declaration
("display:inline").
Original message:
The "nline" identifier is not a valid value for the "display" property. 

I have to mention that the document is not changed in any way. It seems like
the reload of the document wents wrong.

I wonder why this is happening. Could it be that xerces does some caching on
load and something wents wrong there? I would appreciate if somebody could
help me with this problem.

Thanx,
gurks
-- 
View this message in context: http://www.nabble.com/Parse-exception-on-document-reload-tf4352768.html#a12402954
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Parse exception on document reload ... kind of "solution" ;)

Posted by gurks <r....@gmx.at>.
Playing around a little bit I found out that the SVG syntax error occured on
making a deep copy of the
document (cloning). So I tried to write the clone to hard disc to check the
svg output directly. But
after writing the file to disk the error never occured again :) I don't know
what was the problem but
I worked around it now by sending the cloned document into a
ByteArrayOutputStream. The
performance seems to be no problem so I'm happy with this "solution" even
it's not very beautiful ;)

Here is my code:

SVGDocument docClone = (SVGDocument) doc.cloneNode(true);	
try {
   ByteArrayOutputStream stream = new ByteArrayOutputStream();
   OutputStreamWriter writer = new OutputStreamWriter(stream);
   DOMUtilities.writeDocument(docClone, writer);
   writer.close();
   stream.close();
} catch (Exception ex) {
 
}

-- 
View this message in context: http://www.nabble.com/Parse-exception-on-document-reload-tf4352768.html#a12474608
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Parse exception on document reload ... further observations

Posted by gurks <r....@gmx.at>.
I made some further observations related to this problem. When I open up my
document several times
sometimes some parts of the document are drawn wrong e.g. rectangles are
filled with a color that 
shouldn't be filled or elements are missing. Closing and opening up the
document again results in 
another drawing. Most of the time it is drawn right but sometimes it's not.
I think the wrong drawing is
an effect of the parse errors I mentioned.

Another observation I made is the loading time. First time I open the
document it needs a second or 
two to draw the picture. But next time I do this everything goes faster.
That's why I believe that 
somewhere the document is cached (but eventually with errors because of the
error messages I 
posted yesterday).

Does anybody have a similar problem?

-- 
View this message in context: http://www.nabble.com/Parse-exception-on-document-reload-tf4352768.html#a12421784
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org