2011-08-02 67 views
1

我得到這個錯誤在strings.xml檔案:錯誤:錯誤解析XML:綁定前綴錯誤:錯誤解析XML:綁定前綴

<resources> 
    <string name="mainTitle">Remote Doctor </string> 
    <string name="app_name">Remote Doctor</string> 
    <string name="patientButton">Patient Mode </string> 
    <string name="doctorButton">Doctor Mode </string> 
    <string name="aboutButton">About </string> 
    <string name="exit">Exit</string> 
    <string name="simpleMode">Simple Mode</string> 
    <string name="detailedMode">Detailed Mode</string> 
    <string name="aboutTitle">About Remote Doc</string> 
    <string name="aboutText">\ 
    Remote Doc is an application that allows a brace user and the doctor to analyze and record 
    how often the brace is being worn and how much force or pressure the brace is putting on 
    the user  </string> 

    <!-- BluetoothChat -->  
    <string name="send">Send</string>  
    <string name="not_connected">You are not connected to a device</string>  
Error: <string name="bt_not_enabled_leaving">Bluetooth was not enabled. Leaving Bluetooth Chat.</string>  
    <string name="title_connecting">connecting...</string>  
    <string name="title_connected_to">connected to <xliff:g id="device_name">%1$s</xliff:g></string>  
    <string name="title_not_connected">not connected</string>  
    <!-- DeviceListActivity -->  
    <string name="scanning">scanning for devices...</string>  
    <string name="select_device">select a device to connect</string>  
    <string name="none_paired">No devices have been paired</string>  
    <string name="none_found">No devices found</string>  
    <string name="title_paired_devices">Paired Devices</string>  
    <string name="title_other_devices">Other Available Devices</string>  
    <string name="button_scan">Scan for devices</string>  
    <!-- Options Menu -->  
    <string name="secure_connect">Connect a device - Secure</string>  
    <string name="insecure_connect">Connect a device - Insecure</string>  
    <string name="discoverable">Make discoverable</string> 
</resources> 

什麼我做錯了什麼? ?

+3

是的,不知道是什麼,但答案是肯定的。 – jondavidjohn

+0

看看這個SO職位:http://stackoverflow.com/questions/2221221/frequent-problem-in-android-view-error-parsing-xml-unbound-prefix –

回答

7

您不必爲<xliff:g id="device_name">%1$s</xliff:g>

規定在現實中的XML命名空間,你會想逃離圍繞xliff:g標籤< >。在<string>標籤內的文本被作爲原始XML,而不是作爲字符串值的一部分進行處理。

使用這個代替了title_connected_to條目:

<string name="title_connected_to">connected to &lt;xliff:g id="device_name"&gt;%1$s&lt;/xliff:g&gt;<string>

+0

device_name是在定義一個單獨的xml文件 – YoKaGe

+0

device_name.xml:<?xml version =「1.0」 encoding =「utf-8」?> YoKaGe

+0

行,但是您不在資源文件中定義該名稱空間。我不熟悉你想指設備名的方式,但是從一個XML解析器點,這就是爲什麼你提供的XML是無效的。 – Jason

1

BluetoothChat下的第三個具有「錯誤:」寫在它旁邊。這是什麼導致錯誤,或者你添加,以顯示哪一行導致錯誤?

+0

我包括在這個問題 – YoKaGe

1

你的資源標籤

+0

我已經taht它只是沒有在問題出現 – YoKaGe

2

之前需要<?xml version="1.0" encoding="utf-8"?>您使用了錯誤的開始標記爲<resources>。將<resources>更改爲 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2>然後使用常規結束標記

相關問題