I am trying to merge two svg documents together so they display side by side.
To do this I am importing the child nodes of the second document into a new
'g' element of the first document and appending them:
// add <g transform="translate(x,y)"> element to rootElement
Element g = doc1.createElement("g");
g.setAttribute("transform", "translate(" + width + "," + "0)");
rootElement.appendChild(g);
// add to new element all children of root2
NodeList nodeList = root2.getChildNodes();
for ( int j=0; j<nodeList.getLength(); j++ )
{
Node n = doc1.importNode( nodeList.item(j).cloneNode(true), true
);
g.appendChild( n );
}
On the cloneNode of the following element I get a null pointer exception
within createLiveAnimatedPreserveAspectRatio of SVGOMElement:
<g v:mID="0" v:index="1" v:groupContext="foregroundPage">
<title>Page-1</title>
<v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701"
v:drawingUnits="24" v:shadowOffsetX="8.50394" v:shadowOffsetY="-8.50394"
v:shadowType="1"/>
<v:layer v:name="Connector" v:index="0"/>
<g id="shape75-1" v:mID="75" v:groupContext="shape"
transform="translate(974.625,-657.885)">
<title>Sheet.75</title>
<rect v:rectContext="foreign" x="0" y="666.141" width="306.635"
height="180.179" class="st1"/>
<image x="0" y="666.141" width="306.635" height="180.179"
preserveAspectRatio="none" xlink:href="data:image/png;base64,....."
Exception:
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at
org.apache.batik.dom.svg.SVGOMElement.createLiveAnimatedPreserveAspectRatio(Unknown
Source)
at org.apache.batik.dom.svg.SVGOMImageElement.<init>(Unknown Source)
at org.apache.batik.dom.svg.SVGOMImageElement.newNode(Unknown Source)
at org.apache.batik.dom.AbstractNode.cloneNode(Unknown Source)
at org.apache.batik.dom.AbstractParentNode.deepCopyInto(Unknown Source)
at org.apache.batik.dom.AbstractElement.deepCopyInto(Unknown Source)
at org.apache.batik.dom.svg.SVGOMElement.deepCopyInto(Unknown Source)
at org.apache.batik.dom.AbstractNode.cloneNode(Unknown Source)
at org.apache.batik.dom.AbstractParentNode.deepCopyInto(Unknown Source)
at org.apache.batik.dom.AbstractElement.deepCopyInto(Unknown Source)
at org.apache.batik.dom.svg.SVGOMElement.deepCopyInto(Unknown Source)
at org.apache.batik.dom.AbstractNode.cloneNode(Unknown Source)
Any ideas what is causing it?
--
View this message in context:
http://www.nabble.com/Null-pointer-exception-in-createLiveAnimatedPreserveAspectRatio-tf4527834.html#a12919405
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]