The question basically says it all. How can I check if SVG has a viewBox attribute? I am using Batik lib. I need this because I need to (at least) notify the user that there is a viewBox attribute.
Can I delete it?
The question basically says it all. How can I check if SVG has a viewBox attribute? I am using Batik lib. I need this because I need to (at least) notify the user that there is a viewBox attribute.
Can I delete it?
Using org.w3c.dom classes you'd do something along these lines...
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
URL url = new URL(getCodeBase(), "fileName.svg");
Document doc = f.createDocument(url.toString());
Element svg = doc.getDocumentElement();
if (svg.hasAttribute("viewBox")) {
// notify the user somehow
}
to delete call
svg.removeAttribute("viewBox")