我在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>
我做错了什么???
答案 0 :(得分:7)
您没有为<xliff:g id="device_name">%1$s</xliff:g>
实际上,您希望绕过< >
标记周围的xliff:g
。 <string>
标记内的文本将作为原始XML处理,而不是作为字符串值的一部分。
使用此代替title_connected_to条目:
<string name="title_connected_to">connected to <xliff:g id="device_name">%1$s</xliff:g><string>
答案 1 :(得分:2)
您使用<resources>
的错误开头标记。将<resources>
更改为
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2>
然后使用常规结束标记
答案 2 :(得分:1)
BluetoothChat下的第三个在其旁边写着“错误:”。这是导致错误的原因,还是你添加它来显示导致错误的行?
答案 3 :(得分:1)
资源标记
之前需要<?xml version="1.0" encoding="utf-8"?>