XML文件要有根标签(Extra content at the end of the document in file 错误) 博客分类: servletjava servletxml
程序员文章站
2024-02-08 14:53:46
...
使用的xml文档如下
- <?xml version="1.0" encoding="UTF-8"?>
- <SearchConstraints>
- <Begin>glucose</Begin>
- <End>Ethanol</End>
- <Interface>name</Interface>
- <IntermediatesInclude number="0"></IntermediatesInclude>
- <IntermediatesExclude> number="0"></IntermediatesExclude>
- <Organisms type="all"></Organisms>
- <KShort>10</KShort>
- </SearchConstraints>
- <StoPList>
- <StoP>
- <Source id="glucose"></Source>
- <Target id="Ethanol"></Target>
- <RouteList>
- </RouteList>
- </StoP>
- </StoPList>
问题所在:没有加根标签呀!XML文件只能有一个根标签!
把xml改成下面这样就ok了,也就是加一个Document标签,将先前的两个根标签SearchConstraints和StoPList都放到Document标签的下面,从而整个XML文件只有一个根标签。
- <?xml version="1.0" encoding="UTF-8"?>
- <Document>
- <SearchConstraints>
- <Begin>glucose</Begin>
- <End>Ethanol</End>
- <Interface>name</Interface>
- <IntermediatesInclude number="0"></IntermediatesInclude>
- <IntermediatesExclude> number="0"></IntermediatesExclude>
- <Organisms type="all"></Organisms>
- <KShort>10</KShort>
- </SearchConstraints>
- <StoPList>
- <StoP>
- <Source id="glucose"></Source>
- <Target id="Ethanol"></Target>
- <RouteList>
- </RouteList>
- </StoP>
- </StoPList>
- </Document>