XML看起来像这样:
<resources>
<string name="SignInPrompt">Sign in with <b>%1$s</b></string>
</resources>
导航看起来像这样:
if (vnCurrent.toElement(VTDNav.FIRST_CHILD, "string")) {
while (true) {
def currentStringIndex = vnCurrent.getText()
// ^^^^ this is always -1 when it hits the strings with <B>
def currentStringValue = (currentStringIndex != -1) ? vnCurrent.toRawString(currentStringIndex) : ""
if (!vnCurrent.toElement(VTDNav.NEXT_SIBLING)) break
}
我正在尝试抓取XML文本来对其进行处理。 我们不编码
<B> as <B>
因为Android了解如何在从资源中读取字符串时正确转换粗体字符串w / o通过单独的fromHtml调用。