JSON to XML with AngularJS in Preparation for InDesign

In a recent project, I wanted to use Google Sheets as a content management system: the source for a print layout and a website. I wanted the content to reside in a single, easily editable location.

In order to achieve that outcome, InDesign requires the data in an XML file. But first, I had to convert the JSON data in Google Sheets to XML. This would allow me to customize the tag names to leverage the custom mapping styles feature within InDesign, which would make it a breeze to update the InDesign document as the content of the book changed. Read more on JSON to XML with AngularJS in Preparation for InDesign…

RapidXml – A Lightweight xml Library for C++

I don’t write in C++ frequently and I can’t say that I am sad about that. However, we all have those projects where, for some reason or another, we must use a tool that wouldn’t normally be our first choice. In one particular case, just recently, I was given a library written in C++ that I needed to use to perform a specific action on some data. The front end of the application that I was working on was written in Ruby and it basically collected information from different sources and stuffed the data into an XML file. I needed to write a simple shim, in C++, that could read in the data from the XML file and then call the correct functions in the library based on the data contained within.

C++ does not have support for parsing XML data in the standard libraries. I started with a typical Google search, “C++ XML Parsing”, which returned a large number of results… of course. My goal was to find something really lightweight and simple to use. All I wanted to do was iterate over the tree, identify nodes and read attributes. I skimmed through several README files, downloaded a couple libraries and finally stumbled upon RapidXml.

As stated in the project documentation, “RapidXml is an attempt to create the fastest XML parser possible, while retaining usability, portability and reasonable W3C compatibility.” Sounded great to me! I gave it a try and the results were very positive. The library is composed of 4 files, the total size of which is 141KB. Read more on RapidXml – A Lightweight xml Library for C++…

Making Your Site Visible to Search Engines with Sitemaps

Sitemaps are one of the most recognized website navigation elements on the Internet. A sitemap is a method for making a website easily navigable by humans, and highly visible and indexable by search engines. Despite this, there is often confusion about sitemaps, how they are implemented, and how they can be best leveraged with search engine tools for search engine optimization (SEO).

There are generally two categories of sitemaps: human-readable sitemaps and machine-readable sitemaps.

Read more on Making Your Site Visible to Search Engines with Sitemaps…

Simple API Transformations with to_api

With Ruby on Rails, it’s trivial to make an XML api. The to_xml method serializes the object’s contents to xml. Call that method from the controller, and you’re done. But what if you want a trimmed down version for your API? That’s easy too, the controller can pass in the attributes it wants. What if you want a JSON API as well? Add another line to the controller, passing the same options into the as_json method.

Read more on Simple API Transformations with to_api…

Toolsmithing Java with JRuby

JRuby is my favorite Java tool. It lets me wield the power of Java libraries while building tools and abstractions to speed development.

On a current project, I’m using JAXB2 to bind a large set of deeply-nested XML Schemas into Java classes. I have a Rake task to create the classes from the xsd files and bundle them into a jar. From there, I import the classes into JRuby where the software uses them to interact with other systems via XML marshaling.

Read more on Toolsmithing Java with JRuby…