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 Rich Boakes <ri...@port.ac.uk> on 2005/04/15 03:12:53 UTC
Noob using DOM
Hello Batik Users,
Being new to Batik this may be a really silly
question, but I seem to be making a mistake that
is stumping me.
I have a program that creates an SVG DOM and
dumps it to a file. The file renders fine in
the Adobe plugin on IE [1], and also looks good
when imported into Visio.
The problem I have is that if, instead of just
saving the file, I try and display is using
JSVGCanvas (via the setDocument method), then I
get a BridgeException [2].
I've given the FAQ's a read through but come out
the other end still baffled, are there any
gotchas that I've missed? I'll hold back from
pasting code yet in the hope that there's
something blindingly obvious...
Thanks
-Rich
[1] The output that can be loaded:
http://rdfx.org/images/batikdump1.svg
[2] The error message:
org.apache.batik.bridge.BridgeException: null:-1
Cannot find the referenced element:
"#majpath1113527114427"
specified on the element <textPath> - may be a
problem of id
at
org.apache.batik.bridge.BridgeContext.getReferencedElement(BridgeContext.java:582)
at
org.apache.batik.bridge.SVGTextPathElementBridge.createTextPath(SVGTextPathElementBridge.java:65)
at
org.apache.batik.bridge.SVGTextElementBridge.fillAttributedStringBuffer(SVGTextElementBridge.java:859)
at
org.apache.batik.bridge.SVGTextElementBridge.buildAttributedString(SVGTextElementBridge.java:780)
at
org.apache.batik.bridge.SVGTextElementBridge.computeLaidoutText(SVGTextElementBridge.java:501)
at
org.apache.batik.bridge.SVGTextElementBridge.buildGraphicsNode(SVGTextElementBridge.java:237)
at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:210)
at
org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:161)
at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:205)
at
org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:161)
at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:205)
at
org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:161)
at
org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:77)
at
org.apache.batik.swing.svg.GVTTreeBuilder.run(GVTTreeBuilder.java:95)
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Noob using DOM
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Rich,
Rich Boakes wrote:
> Being new to Batik this may be a really silly question, but I seem to be
> making a mistake that is stumping me.
>
> I have a program that creates an SVG DOM and dumps it to a file. The
> file renders fine in the Adobe plugin on IE [1], and also looks good
> when imported into Visio.
This isn't a very good test ;)
For two reasons, first Adobe tends to be quite forgiving (I don't
have experience with Visio). Second, the dump you referenced
is missing the 'xlink:' prefix on the href attributes on the
textPath Elements. Now you must be setting the Namespace when you
construct the DOM otherwise Batik would complain that the textPath
element didn't have an 'href'. So in general saving a DOM and
restoring it may not have a high fidelity.
> The problem I have is that if, instead of just saving the file, I try
> and display is using JSVGCanvas (via the setDocument method), then I get
> a BridgeException [2].
I suspect that when you create the 'path' elements for the textPath
you are _not_ setting the SVG namespace. This bug will 'disappear'
upon save and restore since the elements don't have a prefix.
> I've given the FAQ's a read through but come out the other end still
> baffled, are there any gotchas that I've missed? I'll hold back from
> pasting code yet in the hope that there's something blindingly obvious...
>
> Thanks
> -Rich
>
> [1] The output that can be loaded:
> http://rdfx.org/images/batikdump1.svg
>
> [2] The error message:
> org.apache.batik.bridge.BridgeException: null:-1
> Cannot find the referenced element:
> "#majpath1113527114427"
> specified on the element <textPath> - may be a problem of id
> at
> org.apache.batik.bridge.BridgeContext.getReferencedElement(BridgeContext.java:582)
>
> at
> org.apache.batik.bridge.SVGTextPathElementBridge.createTextPath(SVGTextPathElementBridge.java:65)
>
> at
> org.apache.batik.bridge.SVGTextElementBridge.fillAttributedStringBuffer(SVGTextElementBridge.java:859)
>
> at
> org.apache.batik.bridge.SVGTextElementBridge.buildAttributedString(SVGTextElementBridge.java:780)
>
> at
> org.apache.batik.bridge.SVGTextElementBridge.computeLaidoutText(SVGTextElementBridge.java:501)
>
> at
> org.apache.batik.bridge.SVGTextElementBridge.buildGraphicsNode(SVGTextElementBridge.java:237)
>
> at
> org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:210)
> at
> org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:161)
> at
> org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:205)
> at
> org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:161)
> at
> org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:205)
> at
> org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:161)
> at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:77)
> at
> org.apache.batik.swing.svg.GVTTreeBuilder.run(GVTTreeBuilder.java:95)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org