tags:

views:

604

answers:

1

Hello Folks,

I am parsing a XML string in XElement.Parse("somestring") and insert it into another XElement using add method. so, i want to remove the default utf encoding and xmlns attributs from "somestring" text.

How to do that...

I appreciate your help.

Thanks KJ

A: 

Sounds like you have an XML document including an <?xml declaration. Use the XDocument instead to parse:-

XDocument doc = XDocument.Parse(someString);
existingElem.Add(doc.Root);

As for xmlns try the above and see what you get, I don't think you need worry about. It may only be an issue if your existing document uses a default namespace which differs from your included XML.

AnthonyWJones
Hello,Thanks for your swift reply, it does answer my query.ThanksKJ
KJ