views:

143

answers:

3

I've created in my application the ability for developers to create WPF forms by writing an XML file.

I would like to now write a XML Schema file (.xsd) to validate this XML file so that developers can validate their Form XML before it is put into the system, and so they can get intellisense based on the XML Schema while they develop it.

I did something like this back in 2001 and we used an early version of XML Spy which had an interface that gave the developer intellisense based on the XML Schema as he build his XML file.

What is the best tool to do this today?

  • In Visual Studio can I e.g. open an XML file, attach an XSD, and get intellisense based on the Schema?
  • Or is XML Spy still the dominant tool to do this?
  • Are there any open source tools that do this?
+3  A: 

Certainly, you can do this with Visual Studio, and a lot cheaper than XMLSpy. But it really depends on what you need.

Do you understand XML Schema? Then you probably don't need more than Visual Studio gives you.

Do you need more help with XML Schema? Do you need a graphical interface for creating the schema? Then you need XMLSpy or Stylus Studio, or some other XSD editor that has a GUI.

John Saunders
I don't need a GUI, just the ability for the tool to mark a line red if e.g. 5 column elements have been added and only 4 are allowed, and that attributes have dropdowns of what types of attributes are available for that element according to the schema. I'll give visual studio a try then.
Edward Tanguay
Excellent. Then just be sure to get VS2008 SP1. That's where the latest changes were made to the XML editor. They're even in the Express editions.
John Saunders
When you open the document, press F4 and choose the schema from there, and make sure "use" is ticked. There is the folder in the VS install directory to put the schemas for global recognition but I've never had any luck that way, or inline schema references in the XML (unless it's a file path)
Chris S
+1  A: 

I still use XML Spy 4.0 to edit XML files, because I have an old license and am too cheap to fork out for a recent release.

I haven't ever looked for a replacement, but did find a list of editors at http://en.wikipedia.org/wiki/List_of_XML_editors

There are 2 GNU GPL editors listed, one of which has a proprietary version, which leaves you with XML Copy Editor as a possible candidate.

I haven't looked at Visual Studio 2008 for XML editing however.

Patrick McDonald
A: 

Some links, based on John's answer:

Visual Studio Express's XML editor's features

XSD-based intellisense in XML editor

13ren