Welcome to MSDN Blogs Sign in | Join | Help
Use INFER.EXE to Create XML Schemas

[Blog Map] 

In my post, OpenXmlCodeTester: Validating Code in Open XML Documents I used XSD to validate the build instructions (which are XML that you place in content controls).  INFER.EXE, available at XML Downloads, is your best friend for putting together schemas.  This isn't news,  but I was chatting with one of my dev friends here at Microsoft, and he wasn’t aware of the existence of this tool, so I’m calling attention to it.

Its use couldn’t be simpler – create a directory, put examples of all varieties of your XML documents to validate in the directory, CD to the directory, and run INFER.EXE.  It outputs a schema that correctly specifies if attributes or elements can be repeated, if they are optional, etc.:

 

And while I’m at it, I’m going to recommend a book, Definitive XML Schema, by Patricia Walmsley, published by Prentise Hall (ISBN-10: 0130655678  ISBN-13: 978-0130655677).  In addition to being the best XSD book I’ve read, it is an example of good technical writing – clear, concise, and thorough.

Posted: Saturday, September 13, 2008 10:54 PM by EricWhite

Comments

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# September 13, 2008 6:47 PM

KK Aw said:

I can find XsdInference.exe but not infer.exe.  Has it been removed?

# March 8, 2009 10:22 AM

LisaAn said:

Run XsdInference.exe to install infer.exe.

# September 1, 2009 5:50 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker