Skip to content

Commit

Permalink
Added basic usage info.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmegginson committed Oct 31, 2014
1 parent 9806b24 commit e49991f
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ JavaScript support library for the Humanitarian Exchange Language (HXL) data sta

http://hxlstandard.org

# Overview
## Overview

This library will be designed for use in client-size applications,
including fully-browser-based apps: it will allow loading a HXL
Expand All @@ -16,7 +16,7 @@ client-side libraries like [jQuery](http://jquery.com/),
[D3](http://d3js.org/), and [AngularJS](https://angularjs.org/) (to be
decided).

# Installation
## Installation

Place the file hxl.js somewhere accessible to your HTML page, and then
include it like this (substituting the appropriate path):
Expand All @@ -25,7 +25,31 @@ include it like this (substituting the appropriate path):
<script src="hxl.js"></script>
```

# Tests
## Usage

```
var rawData = [
["Organisation", "Sector/Cluster", "Country"],
["#org/en", "#sector", "#country"],
["UNICEF", "Education", "Columbia"],
["IOM", "CCCM", "Colombia"],
["UNICEF", "Education", "Venezuela"]
];
var dataset = new HXLBuilder().parse(rawData);
for (i in dataset.rows) {
var values = dataset.rows[i].values;
for (j in values) {
var tag = dataset.columns[j].hxlTag;
var lang = dataset.columns[j].lang;
var value = values[j];
// do something with the data
}
}
```

## Tests

libhxl-js uses the [QUnit](http://qunitjs.com/) library from jQuery
for unit testing. All of the required code is included. To run the
Expand All @@ -36,4 +60,7 @@ tests, simply open the file test/index.html in your browser.
License](http://en.wikipedia.org/wiki/MIT_License). This testing code
is not required to deploy libhxl.js.

_TODO_
## License

Except for the QUnit library (for unit testing only), libhxl-js is in
the Public Domain.

0 comments on commit e49991f

Please sign in to comment.