XML檔案要有根標籤(錯誤)的程式碼解決分享

黄舟
發布: 2017-03-30 14:14:54
原創
2658 人瀏覽過

使用的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>
登入後複製

以上是XML檔案要有根標籤(錯誤)的程式碼解決分享的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!