views:

144

answers:

5

I have a xml configuration file for an application and i am wondering which is the best way to keep documentation for it. IE Possible tags, values, etc

Is there a tool, or schema standard or practice that i should follow?

+3  A: 

If your XML file conforms to a schema or a DTD, then this schema or DTD would be a good place to put your documentation. Otherwise, you can supply samples.

Maurice Perry
Or just offer a configuration UI :) - Hand-editing XML isn't exactly high on most people's priority list :)
Joey
@Johannes: That should be a separate answer.
Richard
@Johannes: Yes, but then you would need to document the UI ;)
Maurice Perry
+4  A: 

A lot of people use XML comments (<!-- ... -->) for this.

Aaron Digulla
Assuming the documentation is fairly short, this is a good example of KISS. +1.
Richard
+1  A: 

If you have rolled your own custom config XML format then just generate your own schema for it and document it in there.

eddiegroves
A: 

Something which I've never seen anywhere else but which might make sense: Use a <comment> element and in your parser, ignore anything inside of it. This would allow to have copy'n'paste ready examples in the config file plus you could nest them to explain various points in each example.

Aaron Digulla
A: 

I believe that Aaron Digulla's answer (XML comments) is the simplest. Otherwise, two solutions:

  1. If you control the schema, add a <comment> element (Docbook, for instance, does it).

  2. If you don't, create a namespace like http://www.example.org/mynamespaces/doc and put <comment> elements in the file, prefixed by this namespace, for instance <doc:comment> (this assumes that your XML validation systme will ignore elements in unknown namespaces, as, for instance, NVDL permits).

bortzmeyer