1

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?

Matthew Strawbridge
  • 19,940
  • 10
  • 72
  • 93

2 Answers2

0

This might work for you:

XmlReader - I need to edit an element and produce a new one

Community
  • 1
  • 1
Alex J
  • 9,905
  • 6
  • 36
  • 46
0

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
  • 11,604
  • 5
  • 24
  • 22