tags:

views:

79

answers:

2

Hi. I'm using C# and i need to create a XML document. Ok, i did, but, in each element i need to put a tc prefix.

The only way that i know, is using xmlDoc.CreateElement("tc", "node1", "file.xsd"), but it is very massive because i have lots of tags and my program its already writted.

Is this the only way?

thx

A: 

If you're lucky enough to be using C# 3.5, take a look at LINQ to XML.

Here's a document on How to: Create a Document with Namespaces (C#) (LINQ to XML) from MSDN for the LINQ to XML API.

And if you've never seen LINQ to XML before, take a look at this 5 minute overview

Skrud