Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Version 3.0.2
-
None
-
None
Description
XmlBeans is unable to handle a org.w3c.dom.Document that uses a Doctype Declaratiion. It works if the xml is passed as a String.
import org.apache.xmlbeans.XmlObject; import org.junit.Test; import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; public class SvgGraphicImplTest { @Test public void parseIT() throws Exception { final String svgDocumentString = "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n" + "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n" + "<svg />"; XmlObject.Factory.parse(svgDocumentString); //it works as a String final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); final Document parse = documentBuilder.parse(new ByteArrayInputStream(svgDocumentString.getBytes(StandardCharsets.US_ASCII))); XmlObject.Factory.parse(parse); //this doesnt' } }