2012-01-03 54 views
0

我正在嘗試使用DHTMLXGrid API創建數據網格。從我的XML文檔的小摘錄:無法驗證我的XML文件,以便能夠在DhtmlxGrid中使用它

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<records> 
    <paper> 
     <gid>3</gid> 
     <tid>1</tid> 
     <pid>4</pid> 
     <title>Quality Education as I See It</title> 
     <authors>Dheeraj Mehrotra</authors> 
    </paper> 
    <paper> 
     <gid>3</gid> 
     <tid>1</tid> 
     <pid>5</pid> 
     <title>e-Learning Concept of CMS and the Digitization of Libraries</title> 
     <authors>Meenu Chopra</authors> 

的問題是,當我運行的代碼,它說,不正確的XML,可能原因可能是不正確的架構或使用無效字符。我試圖驗證此XML文件,它給了我這個錯誤:

 Missing "charset" attribute for "text/xml" document. 

The HTTP Content-Type header (text/xml) sent by your web browser (Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.15 (KHTML, like Gecko) Chrome/18.0.986.0 Safari/535.15) did not contain a "charset" parameter, but the Content-Type was one of the XML text/* sub-types. 

The relevant specification (RFC 3023) specifies a strong default of "us-ascii" for such documents so we will use this value regardless of any encoding you may have indicated elsewhere. 

If you would like to use a different encoding, you should arrange to have your browser send this new encoding information. 


Sorry, I am unable to validate this document because on line 441 it contained one or more bytes that I cannot interpret as us-ascii (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication. 
The error was: ascii "\xE2" does not map to Unicode 

行441: 確定風險因子營銷作物利用數據挖掘

以及以前的我修正如雙引號一些錯誤但它不斷尋找更多..

我想用我的XML做的事情是驗證它,以某種方式刪除無效字符,幷包括唯一的ID到每個紙標籤因爲它是DHTMLX API中的要求。我通過我最初創建的csv文件創建了我的xml,它沒有任何選項來創建唯一的ID。

+0

和'441行'? – kan 2012-01-03 10:27:09

+0

編輯的問題,包括行441數據 – ishan 2012-01-03 11:12:54

回答

1

這是一個很長的符號。您正在使用錯誤的編碼。確保你總是使用UTF-8

+0

那麼多數民衆贊成在問題......我不知道如何創建我的xml在utf-8或類似的東西。請告訴我如何從csv文件轉換文件或將其轉換爲utf-8後如何準備它 – ishan 2012-01-03 14:29:30

+0

1)使用例如MS Excel。它支持UTF-8,你也可以添加你問的id列。或2)使用記事本或任何優秀的文本編輯器,然後保存它通常提供的編碼(默認情況下它是CP1252或類似的)。或3)使用任何編程語言編寫一個小型實用程序進行轉換,大多數現代語言使用UTF-8。 – kan 2012-01-03 15:45:46

相關問題