Hi,

I'm storing an element in a database using the result of:
DOMUtilities.getXML(svgDoc.getElementById("icon"));

Now I want to get the element back to add it to a different SVG
document but the only thing I'm getting back from using parseXML is
null. The properties to supply to this method aren't quite clear to me
and I suspect it's going wrong there.


String className = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(className);

Element iconElement = (Element)DOMUtilities.parseXML(iconString,
svgDoc, svgDoc.getBaseURI(), null, null, factory);

iconElement.setAttributeNS(null, "transform", "translate(100,100)");
svgDoc.appendChild(iconElement);


Setting the attribute is where a NPE occurs because iconElement is
null. A wild guess is the factory part since I didn't have a clue what
to do there. Adding e.g. "g" as a wrapper element, just for the fun of
it, makes no difference either. The attempt to use
'SVGDOMImplementation.SVG_NAMESPACE_URI' for the uri failed with the
same result.

Why am I not getting a node back? What are we supposed to supply to
the parseXML method?

Yours,

Age

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to