XML文件要有根标签(Extra content at the end of the document
发布时间:2020-12-16 05:23:58 所属栏目:百科 来源:网络整理
导读:转自:http://bioinfo.ustc.edu.cn/seagven/?p=769 今天在使用php解析XML时出现错误: DOMDocument::load() [domdocument.load]: Extra content at the end of the document in file ***** 使用的xml文档如下 ?xml version="1.0" encoding="UTF-8"? SearchCo
转自:http://bioinfo.ustc.edu.cn/seagven/?p=769
今天在使用php解析XML时出现错误:
DOMDocument::load() [domdocument.load]: Extra content at the end of the document in file ***** 使用的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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |