Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm currently developing a web-based XML managing program for a client (though I may 'market' it for future clients). Currently, it reads an XML document, converts it into manageable Javascript objects, and ultimately spits out indented, easy to read XML code. Edit: The program would be used by clients that don't feel like learning XML to add items or tags, but I (or another XML developer) may use the raw data for quick changes without using an editor.

I feel like fundamentally, its ready for release, but I'm wondering if I should go the extra mile and allow support for remembering (and perhaps making) comments before generating the resulting XML.

Considering that these XML files will probably never be read without a program interpreting it, should I really bother adding support for comments? I'll probably be the only one looking at raw files, and I usually don't use comments for XML anyway.

So, are comments common/important in most XML documents?

share|improve this question
    
If XML was a simple data format, I'd agree that nobody needs to read them. But due to some perverse circumstances, people are writing programs in XML. That's not even mentioning lots of data that does not have a dedicated editor and is edited by hand. –  delnan Mar 19 '12 at 16:35
1  
@delnan well, for the scope of this question, assume that people using this XML generating program intend on separating data from programming logic ;) –  Jeffrey Sweeney Mar 19 '12 at 16:40
2  
It's impossible for anyone to answer a question about "most xml documents". There are millions -- if not 10's or 100's of millions -- of different types of xml documents. –  Bryan Oakley Apr 7 '12 at 16:24
1  
XML is an asset in your project. It should be described from a business and technical perspective adequately in your documentation. INMO, Adding comments within the XML file itself is rather useless if you already describe the document elsewhere. –  Emmad Kareem Apr 7 '12 at 16:47
    
Your title and actual question are two different things. The title asks, in essence "do others do this" but your question body asks "should I do this. Neither type of question really fits the format of this site. –  Bryan Oakley Jun 1 '12 at 22:46

2 Answers 2

Considering that these XML files will probably never be read without a program interpreting it

Then what value is there in a program whose entire purpose is to produce "indented, easy to read XML code"?

I know that I've seen a lot of comments in XML configuration files (Java frameworks and the like). Pretty much none in data files.

The real question is who you expect to use the program and for what purpose. We can't answer that for you.

share|improve this answer
    
The program would be used by clients that don't feel like learning XML to add items or tags, but I (or another XML developer) may use the raw data for quick changes. So, easy to read is somewhat important. I'll update my OP. –  Jeffrey Sweeney Mar 19 '12 at 16:43

Comments are to make code more human readable. They should be used as such.

If your XML is going read by humans (ie config files) then comments are good. If they aren't then they are just bloat and should be left out.

share|improve this answer
    
I've always figured XML is (or should be) self documenting, though I haven't ever gone past using 15 or so unique tags. Do you see comments in purely data XML documents often? –  Jeffrey Sweeney Apr 7 '12 at 16:05
    
all that whitespace for pretty indentation is also bloat. Recently I was processing some documents that were fairly large (a gig or two if memory serves) and they were more than 50% insignificant whitespace. –  Bryan Oakley Apr 7 '12 at 16:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.