I need to store some arbitrary XML data in an XHTML HEAD element, that will be ignored by browsers. A little like an element version of the “data-*” mechanism for making up your own attributes. Is there a standards-compliant way to do this?
edit: Some people asked why I would want to do this. Basically I’m building a service that processes web pages, and I want the creator of the web page to be able to pass optional “hints” to this service to tell it how to parse the page. I haven’t yet decided exactly what the hints will be, so I want to keep that fairly flexible.
My code already uses the Java JSoup library to parse the XHTML, so I thought it would be nice if the same library could parse the “hint” information, rather than having to parse it separately.
Have you tried putting the information in a meta element? For example you might try this:
Edit
Check out this article on Dev Opera. Item 13 (scroll down some on the page) addresses this.