dnewcome / jath

Jath is a simple template language for parsing xml using json markup.
MIT License
68 stars 15 forks source link

Add support for including arbitrary elements to templates #3

Open dnewcome opened 13 years ago

dnewcome commented 13 years ago

We'd like to be able to add some calculated values to the output that don't come from the input XML. For example, recently I used Jath to parse data for use in a Windows Metro application. The application UI is based around items and groups, and when I process my items, I want to assign them to a group, which is a reference to a group object.

Here is an example:

var parsed = Jath.parse( [ '//notes', { id: 'Note_ID', title: 'Title', ... group: pageData.groups[0] } ], xmldoc );

Jath currently supports using an escape character to insert string literals, but It won't work in the case of something that isn't a string.