我在 strings.xml 文件中收到此错误:错误:解析 XML 时出错:未绑定(bind)前缀
<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>
我做错了什么???
最佳答案
您没有为 <xliff:g id="device_name">%1$s</xliff:g>
定义 XML 命名空间
在现实中你会想逃避 < >
xliff:g
周围标签。 <string>
里面的文字标记作为原始 XML 而不是字符串值的一部分进行处理。
使用此代替 title_connected_to 条目:
<string name="title_connected_to">connected to <xliff:g id="device_name">%1$s</xliff:g><string>
关于java - 错误 : Error parsing XML: unbound prefix,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6918246/