Java XML 和带有 '\' 的文档类型在路径中
我在 Windows 上使用 Java 和 Xerces 解析器时遇到问题。我有一个由另一组开发人员准备的文件,他们在 DTD 文件路径中使用反斜杠。该路径以反斜杠开头,这意味着该路径是从根开始的绝对路径。但只要用斜杠就可以这样工作。如果使用反斜杠,则忽略第一个反斜杠,并且路径从工作目录开始。在我看来,这不是使用反斜杠的标准解决方案。我见过的每个 XML 文件都使用斜杠。
有人遇到过类似的问题吗? Xerces 设置中是否有一些解决方法,或者另一个小组是否必须就该标准开展工作? (不幸的是,他们有很多这样的文件,而且他们根本不想更改它们。)
I have a problem with the Java and Xerces parser on Windows. I have a file prepared by another group of developers and they use backslashes in the DTD file path. The path begins with backslash and it should mean, that the path is an absolute path beginning in the root. But it works this way just with slashes. If backslashes used, the first backslash is ignored and the path begins in working directory. In my opinion this is not a standard solution to use backslashes. Each XML file I've ever seen uses slashes.
Have anybody encountered similar problem? Is there some workaround in Xerces settings or must the another group work regarding the standard? (Unfortunately they have a lot of these files and they don't want to change them at all.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那么他们需要停止这样做。它们不符合 XML 标准。 DTD 路径是部分 URI,分隔符是正斜杠:请参阅 #1.2。 3.
Then they need to stop doing that. They are not complying with the XML standard. A DTD path is a partial URI and the separators are forward-slashes: see #1.2.3.