I have an existing system that I do not wish to change where I would like to add meta-data/configuration/annotations to an existing user object/entity.
I do not want to change the schema or UI so I am planning on letting the user add this meta-data through a description field of the object where users normally enter in a description. It turns out this field is rarely used however I would still like people to be able to enter in a description and then the meta-data.
Basically I want the parser to be similar to HTML parsers and not fail-fast.
My 开发者_如何学Gogut is to do something similar to the Java Properties format but use Regex. But property files are pretty weak for representing complex data.
Is there an existing non-fail-fast format I should use?
Here's a good list of standard configuration formats with pros/cons for each:
http://www.faqs.org/docs/artu/ch05s02.html
All of those formats are designed to be easily edited by hand.
EDIT: You described in a comment that you want at most two "layers" of data, in which case the best formats from that page I linked to would be the Windows-style .ini format or the "Record-Jar" format.
It seems that your problem isn't really wanting something that isn't strict - rather, you want to be able to tell the description and metadata apart.
You could probably just use XML and strip anything before the opening tag and after the closing one before presenting it to the parser. Alternatively, you could use whatever but require a fairly unique character sequence (say, >>>METADATA<<<
on a line by itself) between the description and metadata.
精彩评论