How to parse an Xml which contains the field with an new line as it is using java parsers.
如何使用java解析器解析包含具有新行的字段的Xml。
<ThreeDSecure>
<acs_url>https://nithesh/testing</acs_url>
<pareq_message>
dfsgndfisfgsdgsdgsfggsfgsdfgs
rfk/ffsgsdgfdssg32afaaaaffasa
sgsdgsdfgsdfgfg
ssdgfsgs342;dhhdgssssregs
sffsgsdgfdssgsfregssdgsdg54df
fdgdfgdfg
</pareq_message>
</ThreeDSecure>
Here i need to read pareq_message tag value as it is, help me to resolve this. i have used the Xml parsers to read the fields, BUT i'm getting as an String with one line.
在这里,我需要读取pareq_message标签值,帮助我解决这个问题。我已经使用Xml解析器来读取字段,但我得到的是一行字符串。
if("pareq_message".equals(sThreeDSecure)){
String sPareqMessage =threeDSecureCursor.collectDescendantText();
objNBGIBankResponseBean.setPareqMessage(sPareqMessage);
} //if closed (PareqMessage)
1 个解决方案
#1
0
You can use LINQ to XML library to read the text with newline
您可以使用LINQ to XML库来读取带有换行符的文本
XDocument xdoc = XDocument.Load("Data.xml");
var message = xdoc.Descendants("pareq_message").First();
var value = message.Value;
This should work.
这应该工作。
#1
0
You can use LINQ to XML library to read the text with newline
您可以使用LINQ to XML库来读取带有换行符的文本
XDocument xdoc = XDocument.Load("Data.xml");
var message = xdoc.Descendants("pareq_message").First();
var value = message.Value;
This should work.
这应该工作。