ACE91 wrote:
> 
> 
> 
> 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.
> 

First of all, thank you for your help.
I think you're right, in my research I've not found any information who let
me think that it's possible.
So your idea could be a solution, but it imposes to review with a new
algorithm how the unique "id" of each element could be treated. I can have
two different elements in two different svg documents with the same "id" and
I must be able to find the good one (the element I want to modify) in
function of the original embed "use" document when an attribute change is
needed.






-- 
View this message in context: 
http://www.nabble.com/Dynamically-change-attributes-in-a-use-element-tp15352707p15434510.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