簡體   English   中英

為什么這個xml沒有很好地形成?

[英]Why is this xml not well formed?

我一直收到一個錯誤,說xml沒有很好地形成。 我已經嘗試查看本網站上所有其他帖子關於xml沒有很好的形成,他們似乎沒有回答我的問題。 這是xml代碼。 如果提供DTD是必要的,請告訴我,我會發布。 標有錯誤的行。

<story category="national" byline="Karen Wheatley">
   <headline>President Meets with Congress</headline>
   <synopsis><![CDATA[
               The President meet with Congressional leaders today in effort to jump-start
               faltering budget negotiations. Sources described the mood of the meeting
               as "cordial".
               ]]>
   </synopsis>
   <article ref="news801" />
   <image src="img2071" />
</story>
<story category="international">  <!--Error is here!.-->
   <headline>Relief Agencies head to Peru</headline>
   <synopsis><![CDATA[
               Relief agencies headed to Peru today in wake of yesterday's massive earthquake.
               Initial casualty estimates top 8000, in what would be one of the most
               devasting earthquakes in the last 5 years.
               ]]>
   </synopsis>
   <article ref="news802" />
   <image src="img2072" />
   <image src="img2073" />
</story>
<story category="national" byline="Andrew Browne">
   <headline>Congress Approves Judicial Nominee</headline>
   <synopsis><![CDATA[
               By a vote of 55-42, the Senate approved controversial judge Sandra Lehman
               to the bench of the third circuit court.
               ]]>
   </synopsis>
   <article ref="news803" />
   <image src="img2074" />
</story>
<story category="sports">
   <headline>Bucks grab Series Lead</headline>
   <synopsis><![CDATA[
                Last night, the Milwaukee Bucks defeated the Los Angles Lakers to take a 
                3-2 lead in the NBA finals. The series returns to Los Angeles tomorrow night,
                where the Lakers have been undefeated in the playoffs.
               ]]>
   </synopsis>
   <article ref="news804" />
   <image src="img2075" />
</story>
<story category="entertainment" byline="Chandra Parks">
   <headline>"The Witness" tops Box Office</headline>
   <synopsis><![CDATA[
                "The Witness" was the top-ranked movie this week with 18M in sales. Last week's
                box champ, "Another Life", fell to second with 11M in sales.
               ]]>
   </synopsis>
   <article ref="news805" />
</story>

XML文檔必須只有一個根元素。

你從一個<story> ,關閉它,然后開始另一個。

它的格式不正確,因為它有多個頂級元素<story>

為了使其格式良好,您需要使用例如包裝整個文件

<stories>
    .. your file
</stories>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM