Hi,

I have some svg content embedded inside an xml document. I am reading
through the dom and when I find the svg I am trying to convert it into an
svg document.

The svg xml is identified with an xmlns="...".

If I create a new generic document then import the svg node and add it as
the root document node. I have the equivalent of the svg document I want.
Then to convert it into a batik svg document I try to use
DOMUtilities.deepCloneDocument(...)
this only gives back a document with a generic root element (which will
cause an npe if I try to get the root document element). The problem is
that the node.getNamespaceURI() returns null for my intermediate document.

If I copy the deepCloneDocument method and give it the correct namespace it
still cannot work (as the child nodes also have a null namespace I presume)
as the attributes are not copied across.
The new document has a bunch of new attributes on the root svg element and
also has the xmlns="<svg namespace>" repeated, I believe one has the null
namespace and the other has the xmlns namespace

I get the following exception when I attempt to import the root node of the
document into yet another svg document.

java.lang.NullPointerException
        at 
org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElement.java:486)
        at 
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItem(AbstractElement.java:677)
        at 
org.apache.batik.dom.AbstractElement$NamedNodeHashMap.setNamedItemNS(AbstractElement.java:625)
        at 
org.apache.batik.dom.AbstractElement.setAttributeNode(AbstractElement.java:168)
        at org.apache.batik.dom.AbstractElement.copyInto(AbstractElement.java:407)
        at org.apache.batik.dom.svg.SVGOMElement.copyInto(SVGOMElement.java:203)
        at org.apache.batik.dom.AbstractNode.cloneNode(AbstractNode.java:275)
        at org.apache.batik.dom.AbstractDocument.importNode(AbstractDocument.java:211)


Does anyone know if there is a way to handle this.
I just want to get a batik dom svg document that is the equivalent of the
svg that is embedded in the original document.
I cannot create an svg document and then add or replace the root element as
batik won't let me.

Thanks
Keiron.

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

Reply via email to