<分区>
我试图将 XML 作为字符串获取,但所有空格都出现在最终结果中,我尝试了 Regex 和此处的许多答案,但我没有成功。这是我的代码。
public class XMLManager
{
private static XmlDocument xmlInfographic;
private static TextAsset infographicXML;
public XMLManager()
{
infographicXML = Resources.Load("XML/Infographic") as TextAsset;
xmlInfographic = new XmlDocument();
xmlInfographic.LoadXml(infographicXML.text);
}
public static string LoadInformation(int index)
{
return xmlInfographic.DocumentElement.SelectSingleNode("/Infographic/Info/Info" + index).InnerText;
}
}
这里是 XML 文件:
<Infographic>
<Info>
<Info0>
• Something_0.
• Something_0.
• Something_0.
• Something_0.
• Something_0.
</Info0>
<Info1>
• Something_1.
• Something_1.
• Something_1.
</Info1>
</Info>
</Infographic>
当前的输出是这样的:
\r\n
• Someting_1.
• Someting_1.
• Someting_1.
\r\n
我需要的是:
• Someting_1.
• Someting_1.
• Someting_1.