You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2010/02/07 20:43:28 UTC
[jira] Resolved: (XERCESJ-42) Error: DTD file not found if XML file
name contains character such as "%"
[ https://issues.apache.org/jira/browse/XERCESJ-42?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Glavassevich resolved XERCESJ-42.
-----------------------------------------
Resolution: Invalid
Assignee: (was: Xerces-J Developers Mailing List)
As Neeraj pointed out in 2002, '%' is the beginning of an escape sequence in a URI and must be followed by two hexadecimal characters. To include an actual '%' in a URI it must be escaped by the application as "%25" before being presented to the parser.
> Error: DTD file not found if XML file name contains character such as "%"
> -------------------------------------------------------------------------
>
> Key: XERCESJ-42
> URL: https://issues.apache.org/jira/browse/XERCESJ-42
> Project: Xerces2-J
> Issue Type: Bug
> Components: SAX
> Affects Versions: 2.0.0 [beta 2]
> Environment: Operating System: Other
> Platform: All
> Reporter: Yinghua Huang
>
> We are using SAX parser in our new project.
> An XML file, given a normal file name, such as "test.xml", is working fine
> towards SAX parser. But after changing the file name to "tes%t.xml", throws
> error:
> org.xml.sax.SAXParseException: File "test.dtd" not found.
> at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:975)
> at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExtern
> alEntity(DefaultEntityHandler.java:755)
> at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExtern
> alSubset(DefaultEntityHandler.java:566)
> at org.apache.xerces.framework.XMLDTDScanner.scanDoctypeDecl(XMLDTDScann
> er.java:1131)
> at org.apache.xerces.framework.XMLDocumentScanner.scanDoctypeDecl(XMLDoc
> umentScanner.java:2177)
> at org.apache.xerces.framework.XMLDocumentScanner.access$0(XMLDocumentSc
> anner.java:2133)
> at org.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispa
> tch(XMLDocumentScanner.java:882)
> at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
> canner.java:380)
> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861)
> Tried Xerces 1.3.1, 1.4.3 and Xerces 2.0.0 (beta 2), get the same error.
> The following char.s in the file name will get the same exception:
> {, }, [, ], ^, `
> Here is the first two lines of the XML:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE INF_TEST_METADATA SYSTEM "test.dtd">
> If no DTD is defined in the XML and if I disable the validation against DTD
> option for the parser (
> ((XMLReader)parser).setFeature("http://xml.org/sax/features/validation", false);
> ) no exception will occur.
> Thanks,
> Yinghua
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org