Ravindar, Biztalk Developer and Administrator

Just another BizTalk blog

Loop through every node in a xml file, Its useful if u want to replace a character or some thing like it

class Program
{
static void ReplaceAll(XElement element,XDocument document)
{

foreach (var item in element.Elements())
{
if (item.HasElements)
{
ReplaceAll(element,document);
}
}

element.Value.Replace(“”, “&gt”);

document.Save(“XMLFile1.xml”);

}
static void Main(string[] args)
{
XDocument doc = XDocument.Load(“XMLFile1.xml”);
ReplaceAll(doc.Root,doc);
}
}

Advertisements

April 20, 2010 - Posted by | Asp.Net, Biztalk Server

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: