Windows 上的 RELAX NG
我猜测我的问题可能源于与 UTF8 相关的 Windows 文件问题。但话又说回来,代码是基于 Java 的,所以问题可能是任何问题。
我运行了 MSV 和 JING 验证器,两者都给出了与下面相同的结果。但同一个文件在其内部验证器上确实可以很好地验证。我缺少什么?请注意,它在第一个字符处失败,因此解析器不太可能是问题所在。尝试在管理员模式下运行它以消除任何可能的权限问题。相同的结果。
C:\docbook\src>java -jar c:\msv\msv.jar c:\docbook\rnc\docbook.rnc dgsample.xml
-debug
start parsing a grammar.
Content is not allowed in prolog.
1:1@file:///c:/docbook/rnc/docbook.rnc
Exception in thread "main" java.lang.NullPointerException
at com.sun.msv.driver.textui.Driver.run(Driver.java:221)
at com.sun.msv.driver.textui.Driver.main(Driver.java:68)
I am guessing that my problems could stem from Windows file issues related to UTF8. But then again, the code is Java based, so the problem could be anything.
I ran the MSV and JING validators and both gave the same result as in below. But the same file in does validate just fine on it's internal validator. What am I missing? Note it fails on the first character, so the parser is not likely the problem. Tried running it in administrator mode to eliminate any possible permissions issues. Same result.
C:\docbook\src>java -jar c:\msv\msv.jar c:\docbook\rnc\docbook.rnc dgsample.xml
-debug
start parsing a grammar.
Content is not allowed in prolog.
1:1@file:///c:/docbook/rnc/docbook.rnc
Exception in thread "main" java.lang.NullPointerException
at com.sun.msv.driver.textui.Driver.run(Driver.java:221)
at com.sun.msv.driver.textui.Driver.main(Driver.java:68)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题不是Windows(好吧,不是这个特定的问题)
您正在尝试使用紧凑格式的RelaxNG 模式进行验证。 oXygen 可以很好地处理这个问题,因为它在内部使用了 Jing。据我所知,MSV 无法处理紧凑格式。如果您需要使用 MSV 在命令行执行此操作,请使用 oXygen 内置的 Trang 转换器(版本 12.2 中的“工具”菜单,“生成/转换架构”)将您的架构转换为 XML 格式。
假设您使用的是普通的 DocBook 版本,无论如何您也应该有一份 docbook.rng 的副本,这样您就可以这样做(我显然不知道您在哪里存储 jing.jar ):
或者
另一方面,您可以使用 Jing 来执行此操作,但您需要告诉它该文件是紧凑格式:
希望有帮助
Your problem isn't windows (well, not this particular problem)
You are trying to validation using a RelaxNG schema in compact format. oXygen handles this just fine as it uses Jing internally. MSV can't handle compact format as format as I'm aware. If you need to do this at at the command line using MSV then use the Trang converter built into oXygen (Tools menu, Generate/Convert Schema in version 12.2) to convert your schema into the XML format.
Assuming that you are using a normal DocBook release you should have a copy of docbook.rng as well anyway so you could do (I don't know where you store jing.jar obviously):
or
On the other hand you can use Jing to do this but you need to tell it that the file is in compact format:
Hope that helps