You want a SAXSVGDocumentFactory.  It has methods for loading XML:
private static String className = XMLResourceDescriptor.getXMLParserClassName();

private static SAXSVGDocumentFactory factory = new 
SAXSVGDocumentFactory(className);

Michael

________________________________

From: Jan Tosovský [mailto:[email protected]]
Sent: Wed 4/22/2009 4:16 PM
To: [email protected]
Subject: Create SVGDocument by loading XML



Hello Everyone,

I am trying to create new SVG document by parsing ByteArray as Stream:
1. DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
2. SVGDocument svgDocument = (SVGDocument)builder.parse(new
ByteArrayInputStream(svgStream.toByteArray()));

This method fails on 2nd line: java.lang.ClassCastException:
org.apache.xerces.dom.DeferredDocumentImpl cannot be cast to
org.w3c.dom.svg.SVGDocument at ...

If SVGDOMImplementation is used, it offers only to create new document, not
to parsing existing one:
SVGDocument d = (SVGDocument)
SVGDOMImplementation.getDOMImplementation().createDocument(SVGNS, "svg",
null);

Is there any possibility to create SVG document from existing XML code?

Jan


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



<<winmail.dat>>

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

Reply via email to