ошибка: ошибка синтаксического анализа XML: несвязанный префикс - PullRequest
1 голос
/ 03 августа 2011

Я получил эту ошибку в файле strings.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>

Что я делаю не так ???

Ответы [ 4 ]

7 голосов
/ 03 августа 2011

У вас нет пространства имен XML, определенного для <xliff:g id="device_name">%1$s</xliff:g>

На самом деле вы захотите избежать < > вокруг 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>

2 голосов
/ 05 июня 2013

Вы используете неправильный открывающий тег для <resources>.Измените <resources> на <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2>, а затем используйте обычный закрывающий тег

1 голос
/ 03 августа 2011

Вам нужно <?xml version="1.0" encoding="utf-8"?> перед тегом ресурсов

1 голос
/ 03 августа 2011

Третий в BluetoothChat имеет надпись «Ошибка:» рядом с ним.Это является причиной ошибки, или вы добавили ее, чтобы показать, какая строка вызывает ошибку?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...