tags:

views:

9

answers:

1

I'm creating a schema in code and I want to save it to a file. But in the file the schema is not formatted but is display as one big line.

var nsmgr = new XmlNamespaceManager(new NameTable());
nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema");
nsmgr.AddNamespace("name", "someNamespace");

var xtw = new XmlTextWriter("somepath", Encoding.UTF-8);
schema.Write(xtw, nsmgr);

Is there a component that formats the schema?

+1  A: 

You can set some formatting options on XmlWriter, see e.g. this article: http://articles.techrepublic.com.com/5100-22_11-5075652.html

There is the list of possible options: http://msdn.microsoft.com/en-us/library/kbef2xz3.aspx

Grzenio