Xml comments

Jules,

I need access to comments in XML documents for a small xml viewer/editor I’m knocking together.

Can you think of any reasons why the XMLDocument, and XMLElement couldn’t be rejigged to treat comments as a special node type (like text node)?

If I have a crack at doing this, and get it working, would you be interested in the code?

I’m thinking XMLDocument:getDocumentElement() could have a secondary parameter:

const bool treatCommentsAsWhitespace = true

and XMLElement could be given an isComment() method. I’m not sure stylistically whether accessing the comment text should be trough getText() (I.E. treat the comment as a text tag) or a special getComment() method, but I’m leaning towards the latter.

Sure, if you can get it going without adding any extra members to the XmlElement class, or slowing it down too much then I’d certainly be interested in taking a look!