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 Andres Toussaint <an...@onemileup.com> on 2004/11/05 05:34:31 UTC
dom of embed svg image
I want to know if there is a way to access the SVG DOM of a SVG image
included inside another SVG loaded into a JSVGCanvas.
Example of Svg loaded into canvas:
...
<svg ....>
<g id=images>
< image ..... url=otherImage.svg>
</g>
</svg>
I want to get the SVGDocument of otherImage.svg, from within the SVGDocument
from the outermost SVG (loaded in the JSVGCanvas).
I have succesfully walked the GVT of outerImage.svg from within the
outermost SVG, through the gvt.CanvasGraphicsNode. And want to do the same
for the SVG Dom.
Basically, what i want to do is to assemble a SVG file that does not have
any external references, from a original source that does have these
external references (all image elements are also SVG images)
Or is this something i should do outside of batik, merging my svg documents
as xml docs, and then setting the JSVGCanvas to the final doc? (i would not
like this approach, since my app already generates the svg document with
the external references and shows it in a canvas)
Thanks, Andres
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: dom of embed svg image
Posted by Andres Toussaint <an...@onemileup.com>.
Hi Thomas:
This is exactly what i did.
I subclassed SVGImageElementBridge to get the SVG Document instead of a
GVT Tree, if the image element is SVG content.
Since I assumed that the SVGImageElementBridge objects are volatile
(could not figure out how to retrieve them once the GVT is built), i
modified the SVGImageElementBridge.buildImageGraphicsNode(BridgeContext
ctx, org.w3c.dom.Element e) to return a Node instead of a GVT, and
only return it if the stream is a XML document. (Returns null
otherwise).
I then get the SVGSVGElement from the returned SVGDocument (in Node
format) and appendChild it into the base document, assigning
width-height atttributes. This is working fine now, and it allows to
merge-consolidate multiple SVG documents into a single File.
Andres.
On Nov 7, 2004, at 10:28 AM, Thomas DeWeese wrote:
> Tonny Kohar wrote:
>
>>> I want to get the SVGDocument of otherImage.svg, from within the
>>> SVGDocument
>>> from the outermost SVG (loaded in the JSVGCanvas).
>> I am not sure, how about using correspondingElement or
>> correspondingUseElement method from SVGElementInstance.
>
> You can't get the image subtree with these commands.
>
> Currently there isn't an SVG specification on how to do this.
> You can do it with ugly Batik specific stuff.
>
> If you get the SVGContext from the image element
> (batik.dom.svg.SVGOMElement.getSVGContext()). This will be
> an batik.bridge.SVGImageElementBridge. This has a member called
> 'imgDocument' - currently this is protected, so you might have to
> add a getter (I'll add one to CVS). This is the SVG Document
> (assuming the image element references SVG.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>
Re: dom of embed svg image
Posted by Thomas DeWeese <Th...@Kodak.com>.
Tonny Kohar wrote:
>>I want to get the SVGDocument of otherImage.svg, from within the SVGDocument
>> from the outermost SVG (loaded in the JSVGCanvas).
>
> I am not sure, how about using correspondingElement or
> correspondingUseElement method from SVGElementInstance.
You can't get the image subtree with these commands.
Currently there isn't an SVG specification on how to do this.
You can do it with ugly Batik specific stuff.
If you get the SVGContext from the image element
(batik.dom.svg.SVGOMElement.getSVGContext()). This will be
an batik.bridge.SVGImageElementBridge. This has a member called
'imgDocument' - currently this is protected, so you might have to
add a getter (I'll add one to CVS). This is the SVG Document
(assuming the image element references SVG.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: dom of embed svg image
Posted by Tonny Kohar <to...@kiyut.com>.
Hi,
> I want to get the SVGDocument of otherImage.svg, from within the SVGDocument
> from the outermost SVG (loaded in the JSVGCanvas).
I am not sure, how about using correspondingElement or
correspondingUseElement method from SVGElementInstance.
Regards
Tonny Kohar
--
Sketsa
SVG Graphics Editor
http://www.kiyut.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org