What would be the best (most efficient, convenient) way to store conditions applied to some XML document (in Java I have this represented as DOM):
I will give a simple example:
<comments photo_id="109722179">
<comment id="6065" authorname="Rev Dan Catt" datecreate="1141841470”>
Umm, I'm not sure, can I get back to you on that one?
</comment>
</comments>
So I want to be able for users to define conditions on messages in this format, and store to the DB, so later I can apply them as needed.
The conditions would be applied to the:
- Attribute values; Or,
- Values of text nodes;
Some simple examples could be:
- (authorname = “xyz”)
- (comment text contains the keyword “apples”)
- (comment.id > “6000”)
- etc.
You could use a data structure containing
This data structure would have to be serialized to be stored in database. You could use JSON or XML for example.
And to apply the condition, you would have to evaluate the expression, and see if the result(s) of the evaluation match the value with the operator.