Dan Newcome, blog

I'm bringing cyber back

Updated: Jath Javascript XML processor

leave a comment »

I just pushed some updates to the Jath template-based XML processor. The new version adds support for including literal values in the templates and most importantly (for me, right now) support for processing files under Windows Script Host. I’m going to be using this to churn through tons of exported CRM config data soon, so I wanted to get this update out there.

To run under WSH nothing different is required, just include jath.js in the .wsf file and proceed as usual. Jath will detect the environment just as it detects Node.js and various browser versions.

A quick synopsis on using literals — a typical template might look like the following:

var template [ "//status", { id: "@id", message: ":literaldata" } ];

The only difference is that the value “literaldata” is prefixed by a semicolon, marking it as a literal rather than an XPath expression. The output would look something like the following:

[ 
	{ id: "1", message: "literaldata" }, 
	{ id: "3", message: "literaldata" } 
]

The The character can be changed by setting

Jath.literalChar

to another character. Note that the value may be a single character only — no longer strings.

Advertisements

Written by newcome

August 24, 2010 at 6:54 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: