Hi Patrick

The ELEMENT_NODE case is invoking importNode() method recursively for each attribute node and the case for handling attribute node seems to be creating attribute node without value. I have copied deepCloneDocument() method into my class and printed the document incrementally to verify the document being created. It doesn't seem to fill-up the attribute values. I am using Batik 1.5.1. Which version are you using?

thanks
Venkat


[EMAIL PROTECTED] wrote:
RE: problem with JPEGTranscoder

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
[EMAIL PROTECTED]

-----Original Message-----
From: Cameron McCormack [mailto:[EMAIL PROTECTED]]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_____________________________________________________________________
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

--
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with [EMAIL PROTECTED] http://shopnow.netscape.com/

Reply via email to