Hi Guys,

I have not noticed any problem with DeepCloneDocument, but because am using this method in my code I felt compelled to check it out.

I may wrong but on having a look it appears to me that AbstractDocument.importNode copies the node values at the point it handles the ELEMENT_NODE.

.....
 case ELEMENT_NODE:
            Element e = createElementNS(importedNode.getNamespaceURI(),
                                        importedNode.getNodeName());
            result = e;
            if (importedNode.hasAttributes()) {
                NamedNodeMap attr = importedNode.getAttributes();
                int len = attr.getLength();
                for (int i = 0; i < len; i++) {
                    Attr a = (Attr)attr.item(i);
                    if (a.getSpecified()) {
                        e.setAttributeNodeNS((Attr)importNode(a, true));
                    }
                }
            }
            break;
....


Patrick Egan
pegan@gresham-forms.co.uk

-----Original Message-----
From: Cameron McCormack [mailto:cam-batik-users@aka.mcc.id.au]
Sent: 15 June 2004 12:25
To: Batik Users
Subject: Re: problem with JPEGTranscoder


Hi Venkat.

Venkat S Kota:
> I have downloaded the source distribution and found that the attribute
> node value is ignored while creating a new node in the importNode()
> implementation in the AbstractDocument class. See the code snippets
> below.. I presume the bug Cameron mentioned is still existing but I
> couldn't find any open bugs describing such behaviour. Can someone
> explain if my understanding is incorrect?

I think you may be right!  I did have a quick look through
AbstractDocument.importNode yesterday but I missed the fact that it
didn't set the new attribute node's value.

The obvious solution is to add one line:

> AbstractDocument.java
> ------------------------
>    public Node importNode(Node importedNode, boolean deep)
>        throws DOMException {
>        ...
>        Node result;
>        switch (importedNode.getNodeType()) {
>        case ELEMENT_NODE:
>        ...
>          
>        case ATTRIBUTE_NODE:
>            result = createAttributeNS(importedNode.getNamespaceURI(),
>                                       importedNode.getNodeName());
             result.setNodeValue(importedNode.getNodeValue());
>            break;

What with the inactivity of the Batik committers at the moment, who
knows when this will be in CVS.

Cameron

--
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


_____________________________________________________________________
This e-mail has been scanned for viruses by MCI's Internet Managed Scanning Services - powered by MessageLabs. For further information visit http://www.mci.com