如何使用 batik 将 svg 解析为 Document?

how to parse svg to Document with batik?

我的 svg 喜欢这个:

<svg xmlns="http://www.w3.org/2000/svg" 
xmlns:xlink="http://www.w3.org/1999/xlink">
...
</svg>

不只有一个xmlns,如何在batik中定义xmlns?以及如何解析为 Document?

String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
File file = new File(svgURI);
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
Document doc = f.createDocument(svgNS, "svg", file.toURI().toString());

以上代码在运行:

时有异常
Exception in thread "main" org.w3c.dom.DOMException: The current document is unable to create an element of the requested type (namespace: http://www.w3.org/2000/svg, name: usrs).
    at org.apache.batik.dom.AbstractNode.createDOMException(AbstractNode.java:407)
    at org.apache.batik.anim.dom.SVGDOMImplementation.createElementNS(SVGDOMImplementation.java:202)
    at org.apache.batik.anim.dom.SVGOMDocument.createElementNS(SVGOMDocument.java:373)
``
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(uri);