[jdom-interest] Problem handling SVG...

Glenn Tarbox gtarbox at homesquared.com
Fri Nov 10 13:47:34 PST 2000


We're using JDOM to adjust SVG to be consumed by the Adobe SVG Viewer.
It works for the most part except it does something quite unexpected
(at least to me) and breaks the SVG viewer.

The obvious first test is to read in the SVG and spit it out
unaltered.  The before and after SVG is at the end of this message.

A couple of things to notice on the output.  First, there are alot
more attributes in the <svg> tag which correspond (I think) to default
values in the DTD.

In particular, one of these attributes is: xmlns="%SVGNamespace;"
which breaks the Adobe viewer.  If I manually edit the xmlns
attribute out, everything is fine.

One fix is to remove the <!DOCTYPE> element which stops the DTD from
being retrieved and applied.  Another is to play around with the
SAXBuilder's setEntityResolver() method although its not immediately
clear what to return (I would guess a very simple DTD but I'm not
sufficiently expert at this XML stuff to know all the ramifications).

Perhaps a third approach is to somehow adjust how namespaces are
handled in JDOM?

I tried finding the xmlns attribute but it only gets applied in
the XMLOutputter (which I guess is the right behavior...)

Is this working correctly and the Adobe Viewer wrong or is the
namespace behavior somehow broken in JDOM? (Or am I doing something
very wrong?)

thanks,

-glenn

>>>>>>>>>>>>>>>>> Input >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000303 Stylable//EN"
"http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd"
>
<!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In  -->
<svg  width="86.714pt" height="72.428pt" viewBox="0 0 86.714 72.428"
xml:space="preserve">
	<g id="Layer_x0020_1"
style="fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:
4;">
		<path style="fill:#FFFFFF;" d="M86.214,71.928H0.5V0.5h85.714v71.428z"/>
	</g>
</svg>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

>>>>>>>>>>>>>> Output >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG
20000303 Stylable//EN"
"http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd"
> <!-- Generator: Adobe Illustrator 9.0, SVG Export Plug-In  --> <svg
xmlns="%SVGNamespace;" width="86.714pt" height="72.428pt" viewBox="0 0
86.714 72.428" xml:space="preserve" preserveAspectRatio="xMidYMid meet"
enableZoomAndPanControls="true" contentScriptType="text/ecmascript"
contentStyleType="text/css">   <g id="Layer_x0020_1"
style="fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:
4;">
		    <path style="fill:#FFFFFF;" d="M86.214,71.928H0.5V0.5h85.714v71.428z"
/>
	  </g> </svg>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


Glenn H. Tarbox Ph.D, CTO - HomeSquared Inc.
5927 Priestly Drive, Suite 250, Carlsbad, CA  92008
760.929.3663 X110  |  Cell: 858.945.0359




More information about the jdom-interest mailing list