开发者

How to format schema output

开发者 https://www.devze.com 2023-01-12 16:06 出处:网络
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.

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");

v开发者_开发知识库ar xtw = new XmlTextWriter("somepath", Encoding.UTF-8);
schema.Write(xtw, nsmgr);

Is there a component that formats the schema?


You can set some formatting options on XmlWriter, see e.g. this article: https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-22_11-5075652.html

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

0

精彩评论

暂无评论...
验证码 换一张
取 消