Hi, I want to manipulate a SVG document (loaded from a file) using Batik's SVG DOM api (org.apache.batik.dom.svg).
(1) The sample in Batik's website show that to get a SVGDocument instance, I have to cast from a org.w3c.dom.Document, which in turn I obtain from SAXSVGDocumentFactory. String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser); InputStream is = new FileInputStream("svgdom\\resource\\sample.svg"); Document doc = f.createDocument(null, is); SVGDocument svgDoc = (SVGDocument)doc; Is this the most appropriate way ? Can I load a SVG file (into SVGDocument) without using org.w3c.dom.Document as the medium ? (2) To navigate the SVG DOM, I started by calling SVGDocument.getRootElement(), which return a SVGSVGElement. To get the list of children nodes from this root, I use the inherited org.w3c.dom.Node.getChildNodes(). NodeList nodeList = svgDoc.getRootElement().getChildNodes(); Is this the right way go get a list of children nodes ? Is there a SVG DOM specific API for getting the list of children nodes ? Maybe if I only want to get children that are SVGRect element ? (3) To know which node represents what SVG element. I use the inherited org.w3c.dom.Node.getNodeName(), and compare with strings such as "path", "polyline", etc. Again, is the correct way ? Is there a SVG DOM api that can achive the same effect without comparing each strings ? Maybe a .isPath() method, for example. ** Obviously I am new to XML, SVG and Batik. Thanks you in advance for answering these basic questions :) ** Thanks. ~KEGan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]