Skip to main content

cloneNode method absence in SVG Tiny 1.0 DOM (JSR 226)

1 reply [Last post]
micik
Offline
Joined: 2006-09-04
Points: 0

Hi everyone!

I use jsr 226 v1.0 and I need to clone some node. Interface org.w3c.dom.Node does not support method cloneNode in v1.0 and 1.1. This method presents only in v1.2. Does anybody have any idea how to clone nodes in JSR 226 v1.0 ?

Thanks a lot in advance.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
terrencebarr
Offline
Joined: 2004-03-04
Points: 0

Hi,

You are correct that the cloneNode() functionality is not supported in the JSR 226 (and the underlying SVG Tiny 1.1) specification.

There are basically two options to proceed:

1. To use the "Use" element to refer to the node that you want to clone. A "use" reference is not a clone, it is a reference, but it will help achieve the goal of getting a node that has the same properties as the one being cloned.

2. Create an empty Node, and then write some wrapper code that copies the properties that are relevant to a particular Node (say Rect) from the node to cloned to the new node. Ofcourse this requires the copying code to know which type of Node is being cloned/copied.

The clone() functionality is coming in JSR 287.

Hope this helps,

-- Terrence

Terrence Barr
Evangelist, Java Mobile & Embedded Community
Sun Microsystems, Germany
www.mobileandembedded.org