需要帮助来解决xml解析器错误

时间:2010-03-04 14:02:53

标签: xml solr

我的xml文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<table_data name="finals">
    <row id="2706" lat="40.6894729000" lng="-73.9692572000" body="Rumor:owner does buybacks atBrooklyn Public House in Fort Greene...are the bartenders as nice? #bars #nyc #fortgreene - www.buybacknyc.com"/>
    <row id="2707" lat="40.7127490000" lng="-73.9567950000" body="http://twitpic.com/163iax - Ottoman Lounge on Grand Street in Williamsburg Brooklyn, next to Taco Chulo restaurant."/>
    <row id="2708" lat="40.7127490000" lng="-73.9567950000" body="RT @NYCphotos: http://twitpic.com/163iax - Ottoman Lounge on Grand Street in Williamsburg Brooklyn, next to Taco Chulo restaurant."/>
</table_data>

使用solr-1.5ant索引此文件时,我收到了错误消息:

[java] Exception in thread "main" org.xml.sax.SAXParseException: Element type "row" must be followed by either attribute specifications, ">" or "/>".
     [java]     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
     [java]     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.seekCloseOfStartTag(XMLDocumentFragmentScannerImpl.java:1391)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1324)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
     [java]     at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
     [java]     at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
     [java]     at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
     [java]     at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
     [java]     at OSM2Solr.process(OSM2Solr.java:44)
     [java]     at Driver.main(Driver.java:80)
     [java] Java Result: 1

BUILD SUCCESSFUL

我的元素“row”后跟属性,为什么会出现此错误?

请帮助我。

提前致谢。

1 个答案:

答案 0 :(得分:0)

我有同样的错误。

我的问题出在schema.xml的架构名称中。架构名称必须是1个字!

<schema name="My Schema" version="0.1"> FAIL!

<schema name="MySchema" version="0.1"> RIGHT!