entityresolver

Java XML processing entity problem?

牧云@^-^@ 提交于 2020-01-11 04:49:26
问题 I get the following error when I try to run my java program(it's supposed to read an xml file and print out some of the content). From what I understand there is an unreferenced entity which is not part of the xml standard so my question is; how can I fix this problem? Thanks, [Fatal Error] subject.xml:4:233: The entity "rsquo" was referenced, but not declared. org.xml.sax.SAXParseException: The entity "rsquo" was referenced, but not declared. at com.sun.org.apache.xerces.internal.parsers

When merging multiple xml files, how can I set EntityResolver for child xml files as well besides the parent xml?

与世无争的帅哥 提交于 2019-12-24 20:52:32
问题 I have a book xml file which references other multiple xml files. When I try to run an xslt on the book.xml file, the EntityResolver in my code resolves the dtd path. However, for the children xml files which are being merged, the dtd paths are not resolved. Sample sample_book.ditamap <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE bookmap PUBLIC "-//OASIS//DTD DITA BookMap//EN" "bookmap.dtd"> <bookmap> <booktitle> <mainbooktitle>sample book</mainbooktitle> </booktitle> <part navtitle=

Java - xsl transformation -DTD as entity resolver Premature end of file

若如初见. 提交于 2019-12-12 04:39:22
问题 Java - spring - xsl transformation with dtd as entity resolver. I have a following method private Source resolveDTDEntity(Reader input, final String dtdName) throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setValidating(false); docBuilderFactory.setNamespaceAware(true); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); //Satisfying dtd dependency docBuilder

Java: How to prevent 'systemId' in EntityResolver#resolveEntity(String publicId, String systemId) from being absolutized to current working directory

旧巷老猫 提交于 2019-12-05 20:37:27
问题 I want to parse the following XML document to resolve all entities in it: <!DOCTYPE doc SYSTEM 'mydoc.dtd'> <doc>&title;</doc> My EntityResolver is supposed to fetch the external entity with the given system ID from the database and then do the resolution, see below for an illustration: private static class MyEntityResolver { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { // At this point, systemId is always absolutized to the current

Java: How to prevent 'systemId' in EntityResolver#resolveEntity(String publicId, String systemId) from being absolutized to current working directory

做~自己de王妃 提交于 2019-12-04 04:33:10
I want to parse the following XML document to resolve all entities in it: <!DOCTYPE doc SYSTEM 'mydoc.dtd'> <doc>&title;</doc> My EntityResolver is supposed to fetch the external entity with the given system ID from the database and then do the resolution, see below for an illustration: private static class MyEntityResolver { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { // At this point, systemId is always absolutized to the current working directory, // even though the XML document specified it as relative. // E.g. "file:///H:/mydoc.dtd