开发者

beautifying multiple XSD files

I have about 50 XSD files that are really badly formatted.

I know if I open them all in Visual Studio, I can beautify them one by one.

My question is: Is there a way to command line beautify them or some way开发者_如何学JAVA I can do this in bulk?


Not sure about the commandline program; but I think PowerCommands 10.0 can help you.

Format document on save / Remove and Sort Usings on save:

The Format document on save option formats the tabs, spaces, and so on of the document being saved. It is equivalent to pointing to the Edit menu, clicking Advanced, and then clicking Format Document. The Remove and sort usings option removes unused using statements and sorts the remaining using statements in the document being saved.

Note: The Remove and sort usings option is only available for C# documents.

Note: Format document on save and Remove and sort usings both are initially defaulted OFF.


Another option would be to use a tool like HTMLTidy (http://tidy.sourceforge.net/). This offers a command line tool, so you could easily write a .bat file to format a bunch of files at once.


if you have perl installed you can use the xmlpp script

example:

c:\> perl xmlpp.pl yada.xml
<xml>
  <yada>asd</yada>
  <da>
    <bla>ada</bla>
    <bla>adaa</bla>
  </da>
</xml>

c:\>

and then use the for loop in command line to prettyfy your xml by:

c:\> for %X in (*.xml) do (perl xmlpp.pl %X > %X.pretty)


The XMLStarlet "Swiss Army Knife" for XML can pretty print XML as well. It's command line and thus scriptable to batch process all your files. See http://xmlstar.sourceforge.net/ (Windows version downloadable here.)


You could use XSD.exe to generate classes from your XSDs, build an assembly of your classes, then use XSD.exe again against your new DLL to regen your XSDs.

You can also use SvcUtil.exe to do the same.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜