views:

15

answers:

1

I have an xml file that is like this:

<xml>I need this text<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"
A: 

Have you considered Trim, specifying the characters?

Cherian
I did but I think something has to be really wrong here. why are the spaces and carriage return being added in in the first place?
zachary
"the problem is that there are carrige returns and spaces that don't exist in the file"Are you 100% sure? What does the file look like in Notepad or TextPad?
Kris Krause
yeah good catch. they are there
zachary