首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >eXist中XSL-FO文件的验证错误(使用Jing和Jaxp)

eXist中XSL-FO文件的验证错误(使用Jing和Jaxp)
EN

Stack Overflow用户
提问于 2016-03-02 12:08:43
回答 1查看 87关注 0票数 0

我正在加紧测试基于eXist-db的应用程序中pdfs的生成。验证方案非常简单:

代码语言:javascript
复制
let $doc := xmldb:document('/db/apps/my-app/data/test.fo')
let $grammar := xmldb:document('/db/apps/my-app/resources/catalogs/fop.xsd')
let $validator1 := validation:jaxp-report($doc, false(), $grammar)
let $validator2 := validation:jing-report($doc, $grammar)
return
    ($validator1, $validator2)

结果1:

代码语言:javascript
复制
<report>
    <status>invalid</status>
    <namespace>http://www.w3.org/1999/XSL/Format</namespace>
    <duration unit="msec">135</duration>
    <message level="Error" line="1" column="95">cvc-elt.1.a: Cannot find the declaration of element 'fo:root'.</message>
</report>

结果2:

代码语言:javascript
复制
<report>
  <status>invalid</status>
  <duration unit="msec">245</duration>
  <exception>
    <class>java.lang.NullPointerException</class>
    <stacktrace>java.lang.NullPointerException at
        org.apache.xerces.impl.xs.XMLSchemaLoader.resolveDocument(Unknown Source) at
        org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source) at
        org.apache.xerces.impl.xs.XMLSchemaValidator.getGlobalElementDecl(Unknown Source) at
        org.apache.xerces.impl.xs.SubstitutionGroupHandler.getMatchingElemDecl(Unknown Source) at
        org.apache.xerces.impl.xs.models.XSDFACM.oneTransition(Unknown Source) at
        org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at
        org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at
 com.thaiopensource.validate.xerces.ValidatorImpl.startElement(ValidatorImpl.java:172) at
        org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at
        org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at
        org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at
        org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at
        org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at
        org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at
        org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at
        org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at
        org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at
 com.thaiopensource.validate.ValidationDriver.validate(ValidationDriver.java:160) at
        org.exist.xquery.functions.validation.Jing.eval(Jing.java:164) at
        org.exist.xquery.BasicFunction.eval(BasicFunction.java:70) at
        org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:56) at
        org.exist.xquery.LetExpr.eval(LetExpr.java:142) at
        org.exist.xquery.LetExpr.eval(LetExpr.java:187) at
        org.exist.xquery.LetExpr.eval(LetExpr.java:187) at
        org.exist.xquery.LetExpr.eval(LetExpr.java:187) at
        org.exist.xquery.BindingExpression.eval(BindingExpression.java:165) at
        org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71) at
        org.exist.xquery.PathExpr.eval(PathExpr.java:267) at
        org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:71) at
        org.exist.xquery.XQuery.execute(XQuery.java:280) at
        org.exist.xquery.XQuery.execute(XQuery.java:200) at
        org.exist.http.servlets.XQueryServlet.process(XQueryServlet.java:492) at
        org.exist.http.servlets.XQueryServlet.doPost(XQueryServlet.java:198) at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:755) at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at
        org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at
        org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at
        org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at
        org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:575) at
        org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at
        org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at
        org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at
        org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at
        org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at
        org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at
        org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:229) at
        org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:103) at
        org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:50) at
        org.exist.http.urlrewrite.XQueryURLRewrite.doRewrite(XQueryURLRewrite.java:557) at
        org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:357) at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at
        org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at
        org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1496) at
 de.betterform.agent.web.filter.XFormsFilter.doFilter(XFormsFilter.java:171) at
        org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1476) at
        org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501) at
        org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at
        org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533) at
        org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at
        org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at
        org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429) at
        org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at
        org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at
        org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at
        org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) at
        org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at
        org.eclipse.jetty.server.Server.handle(Server.java:370) at
        org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at
        org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982) at
        org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043) at
        org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) at
        org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) at
        org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at
        org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696) at
        org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53) at
        org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at
        org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at
 java.lang.Thread.run(Thread.java:745) </stacktrace>
  </exception>
</report>

服务器的控制台:

代码语言:javascript
复制
[Fatal Error] :-1:-1: Premature end of file.

我找不到问题出在哪里。然而,pdf是通过FOP顺利生成的。我检查了所有文件的mime类型,试图返回文档、语法和结果,但它总是将相同的内容抛到控制台。

我使用eXist 3.0.RC1

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-04 19:59:10

这个特定的问题已经在2010年的https://github.com/relaxng/jing-trang/commit/db858d18a8c7e6e525bd5df25b1054b7f8d26e95中得到了解决;在现有数据库中,旧的20091111版本仍在使用中。

我显然错过了@georgebina一直在维护的代码库;我将尝试更新eXist-db 3.0版本的JAR文件。

我把https://github.com/eXist-db/exist/issues/965作为我的提醒。

请注意,

代码语言:javascript
复制
[Fatal Error] :-1:-1: Premature end of file.

是撒克逊相关的问题,与京无关。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35746833

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档