引人注目的xml值中的错误

时间:2014-01-11 19:08:55

标签: android xml android-xml

我知道xml值具有用于编写& < >

等特殊字符的特殊代码

但是,我的代码不包含任何这些字符。

<string name="scientists_descrption">(26 December 1791  18 October 1871) was an English polymath.He was a mathematician, philosopher, inventor and mechanical engineer, who is best remembered now for originating the concept of a programmable computer.\n Considered a "father of the computer", Babbage is credited with inventing the first mechanical computer that eventually led to more complex designs. His varied work in other fields has led him to be described as "pre-eminent" among the many polymaths of his century.\n Parts of Babbage's uncompleted mechanisms are on display in the London Science Museum. In 1991, a perfectly functioning difference engine was constructed from Babbage's original plans. Built to tolerances achievable in the 19th century, the success of the finished engine indicated that Babbage's machine would have worked.</string>

但是我在这个字符串中仍然有错误。

有什么帮助吗?

2 个答案:

答案 0 :(得分:1)

您必须使用反斜杠转义',因此只需将所有'替换为\'

<string name="scientists_descrption">(26 December 1791  18 October 1871) was an English polymath.He was a mathematician, philosopher, inventor and mechanical engineer, who is best remembered now for originating the concept of a programmable computer.\n Considered a "father of the computer", Babbage is credited with inventing the first mechanical computer that eventually led to more complex designs. His varied work in other fields has led him to be described as "pre-eminent" among the many polymaths of his century.\n Parts of Babbage\'s uncompleted mechanisms are on display in the London Science Museum. In 1991, a perfectly functioning difference engine was constructed from Babbage\'s original plans. Built to tolerances achievable in the 19th century, the success of the finished engine indicated that Babbage\'s machine would have worked.</string>

答案 1 :(得分:0)

您的错误是因为您没有在string内反对双引号。

..."father of the computer"...必须为...\"father of the computer\"...

虽然单引号可能会遇到同样的问题。