jeremie_76 wrote:
> 
> Hello,
> 
> I have SVG documents with references to another SVG documents (using use)
> and I would like to dynamically change attributes in the externals SVG
> documents.
> 
> When I load the top level svg document, I get the DOM representation of it
> but I only have a reference to a use Element. So is it possible with this
> use Element to dynamically modify the objects attributes in the use
> document (like the fill of a rectangle) ?
> 
> Thank's
> 
> 
>From my experience, this isn't possible. I'm not a Batik developer or
anything, but I've used it for months now and looked for a feature like
this, but never found one. I don't think use elements can be modified, but
there are alternatives if you want to put one SVG document inside another.

The easiest way to put one SVG document inside another is to load each as a
separate SVGDocument object inside your Batik program, and then import the
node from one document into another, like this:

doc1.getRootElement().appendChild(doc1.importNode(doc2.getElementById("someObject")));

When you do this, the external document becomes a part of the DOM tree and
can be modified like any other element.

Now, if for some reason you must use a use element instead of this, you're
out of luck. As far as I know, there's no way to modify the contents of a
use element.
-- 
View this message in context: 
http://www.nabble.com/Dynamically-change-attributes-in-a-use-element-tp15352707p15396149.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to