[英]Exception when parsing structure.rdf.u8, using Jena
Model model = ModelFactory.createDefaultModel();
InputStream in = FileManager.get().open( "W:\\structure.rdf.u8" );
model.read(in, null);
model.write(System.out);
I use the above code, which is provided in the Jena documentation, to parse the ODP . 我使用Jena文档中提供的上述代码来解析ODP 。 First it gave some exception, so I added all the jar files in the Jena package and got the following long exception: 首先,它给出了一些异常,因此我将所有jar文件添加到Jena包中,并得到以下长异常:
log4j:WARN No appenders could be found for logger (org.apache.jena.riot.system.stream.JenaIOEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.apache.jena.riot.RiotException: [line: 5, col: 5 ] {E201} The attributes on this property element, are not permitted with any content; expecting end element tag.
at org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.error(ErrorHandlerFactory.java:128)
at org.apache.jena.riot.lang.LangRDFXML$ErrorHandlerBridge.error(LangRDFXML.java:246)
at org.apache.jena.rdfxml.xmlinput.impl.ARPSaxErrorHandler.error(ARPSaxErrorHandler.java:37)
at org.apache.jena.rdfxml.xmlinput.impl.XMLHandler.warning(XMLHandler.java:196)
at org.apache.jena.rdfxml.xmlinput.impl.XMLHandler.warning(XMLHandler.java:173)
at org.apache.jena.rdfxml.xmlinput.impl.XMLHandler.warning(XMLHandler.java:168)
at org.apache.jena.rdfxml.xmlinput.impl.ParserSupport.warning(ParserSupport.java:194)
at org.apache.jena.rdfxml.xmlinput.states.Frame.warning(Frame.java:55)
at org.apache.jena.rdfxml.xmlinput.states.WantEmpty.characters(WantEmpty.java:33)
at org.apache.jena.rdfxml.xmlinput.impl.XMLHandler.characters(XMLHandler.java:137)
at org.apache.xerces.parsers.AbstractSAXParser.characters(Unknown Source)
at org.apache.xerces.impl.XMLNamespaceBinder.characters(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
` `
I don't know if I need to remove some of the jar files to fix this or the code provided in the Apache site is wrong? 我不知道是否需要删除一些jar文件来解决此问题,或者Apache站点中提供的代码错误?
It's not legal RDF/XML; 这不是合法的RDF / XML; close but has errors. 关闭但有错误。 (at least the one http://rdf.dmoz.org/rdf/structure.rdf.u8.gz
isn't) (至少不是一个http://rdf.dmoz.org/rdf/structure.rdf.u8.gz
)
r
namespace is wrong (should be http://www.w3.org/1999/02/22-rdf-syntax-ns#
, not http://www.w3.org/TR/RDF/
). r
名称空间错误(应为http://www.w3.org/1999/02/22-rdf-syntax-ns#
,而不是http://www.w3.org/TR/RDF/
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.