[owslibjs] Using Jsonix for OWS
Bart van den Eijnden
bartvde at osgis.nl
Wed Aug 20 12:17:00 PDT 2014
I can safely say that working with JSONIX has been a pleasure for me up until now, with great help from Aleksei. I’ve used it for all WPS formats (GetCapabilities, DescribeProcess and Execute).
No need for re-inventing the wheel with owslib.js, at least with my 2 cents.
Best regards,
Bart
On 17 Aug 2014, at 20:30, Aleksei Valikov <valikov at gmx.net> wrote:
> Hi everyone,
>
> I'd like to introduce my open-source JS library, Jsonix (https://github.com/highsource/jsonix) which - in my opinion suits very well for OWS needs.
>
> Jsonix stands for "JSON interfaces for XML" and allows converting between JSON and XML in certain schema with no pain.
> Here's a small code example to demonstrate what it looks like:
>
> // First we construct a Jsonix context - a factory for unmarshaller (parser)
> // and marshaller (serializer)
> var context = new Jsonix.Context([PO]);
>
> // Then we create a unmarshaller
> var unmarshaller = context.createUnmarshaller();
>
> // Unmarshal an object from the XML retrieved from the URL
> unmarshaller.unmarshalURL('po.xml',
> // This callback function will be provided
> // with the result of the unmarshalling
> function (unmarshalled) {
> // Alice Smith
> console.log(unmarshalled.value.shipTo.name);
> // Baby Monitor
> console.log(unmarshalled.value.items.item[1].productName);
> });
>
> You can try it online in JSFiddle: http://jsfiddle.net/lexi/LP3DC/
>
> Jsonix is schema-driven. You can basically take an XML Schema and compile it into JSON-XML mappings.
> Jsonix will then be able to unmarshal XML into JSON which is very easy to process in JavaScript programs.
> You can also marshal JSON into XML so you're getting the full XML<->JSON rountrip for free.
>
> Java developers out there will defintely recognize similarities to JAXB. Jsonix is basically a JAXB analog for JavaScript.
>
> I wrote Jsonix with OGC Schemas in mind.
> Here's a WMS demo: https://github.com/highsource/jsonix/tree/master/demos/wms
> Here's a sample WPS project: https://github.com/highsource/jsonix/tree/master/nodejs/tests/wps
>
> So if you need a reliable, schema-driven, strongly-typed and structured XML-JSON conversion for you target OGC spec, you can take Jsonix, compile your schema and save all those gory XML-to-JSON-and-back details, just concentrate on your payload in a neat predictable JSON form.
>
> Jsonix works in most browsers (browser protability is ~ OpenLayers).
> Works with node.js. Works with RequireJS. No conflicts with OpenLayers.
> Open-source (3-clause BSD), no strings attached.
> Heavily tested.
>
> I'd be very glad if you consider using Jsonix for OWS. I'd be happy to provide support and help as much as I can.
>
> Best wishes,
> Alexey Valikov
> _______________________________________________
> owslibjs mailing list
> owslibjs at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/owslibjs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/owsjs/attachments/20140820/238f7cbc/attachment.html>
More information about the owsjs
mailing list