You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "PJ Fanning (JIRA)" <ji...@apache.org> on 2019/03/14 04:51:00 UTC
[jira] [Assigned] (XMLBEANS-538) Unable to parse a Node with a
Doctype
[ https://issues.apache.org/jira/browse/XMLBEANS-538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
PJ Fanning reassigned XMLBEANS-538:
-----------------------------------
Assignee: PJ Fanning
> Unable to parse a Node with a Doctype
> -------------------------------------
>
> Key: XMLBEANS-538
> URL: https://issues.apache.org/jira/browse/XMLBEANS-538
> Project: XMLBeans
> Issue Type: Bug
> Affects Versions: Version 3.0.2
> Reporter: Thorsten Goetzke
> Assignee: PJ Fanning
> Priority: Major
> Fix For: Version 3.0.3
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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.
> {code:java}
> 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'
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org