The issues that come with connecting the legacy enterprise to the cloud mean dealing with heavyweight technologies such as XML. To that end, Rackspace developers have built and open-sourced a library for creating XML documents called “node-elementtree,” a Node.js Library to build and parse XML documents.
Tomaz Muraus writes on the Rackspace blog that none of the developers really care for XML but they have to support it as some of its API customers still use it. They prefer JSON instead, the chosen lightweight service for developers everywhere.
The need for node-elementtree came as Rackspace started building out a monitoring-as-a-service (MaaS) platform. As more data moves to cloud environments there is an interdependency that IT needs to understand. MaaS is intended to help in that effort.
Rackspace developers found that there wasn’t a good library available for creating XML documents. So the team decided to build their own.
The group decided to model its library on the Python-based ElementTree, an API for parsing XML. According to the Python.org site, the Element Tree API “is a flexible container object, designed to store hierarchical data structures in memory.”
Rackspace uses node-elementtree for MaaS in two places:
1. Sending usage documents to an Atom Hopper instance
2. Returning a response to the API user which has requested a response format to be XML
In the second case we actually use it in combination with our validation and serialization framework called Swiz. We use Swiz to define field types and validators for every object in the system. When a user hits our API and requests XML, Swiz serializes the response using the object definition and node-elementtree library.
There is a recognition that XML has to be dealt with as API customers still use it. node-elementtree offers a modern way to build and parse XML documents in an environment more friendly to a new generation of developers.