开发者

Dealing with spaces in linq to xml

开发者 https://www.devze.com 2022-12-16 11:52 出处:网络
I have an xml file that is like this: <xml>I need this tex开发者_如何学Pythont<notthistext>blahblah<notthistext></xml>

I have an xml file that is like this:

<xml>I need this tex开发者_如何学Pythont<notthistext>blahblah<notthistext></xml>

I get the text by doing something like this:

var mycollection = from myNode in myDoc.descendents("xml") select new { test = Convert.ToString(myNode.Nodes().First())}

but the problem is that there are carrige returns and spaces that don't exist in the file

this is what i get:

"/r/n      I need this text"

What is going on!!!!! What i need is:

"I need this text"


Have you considered Trim, specifying the characters?

0

精彩评论

暂无评论...
验证码 换一张
取 消