An open API service indexing awesome lists of open source software.

https://github.com/phpbench/tabular

Transform an XML document into a tabular data set. Better than spreadsheets.
https://github.com/phpbench/tabular

Last synced: 9 months ago
JSON representation

Transform an XML document into a tabular data set. Better than spreadsheets.

Awesome Lists containing this project

README

          

Tabular
=======

![tabularlogo-2](https://cloud.githubusercontent.com/assets/530801/9979505/11e271ce-5f71-11e5-85e1-b76b17b06609.png)

[![Build Status](https://travis-ci.org/phpbench/tabular.svg?branch=master)](https://travis-ci.org/phpbench/tabular)
[![StyleCI](https://styleci.io/repos/40823691/shield)](https://styleci.io/repos/40823691)

Tabular is a library for transforming a source XML document into a tabular XML
document using a given configuration. The resulting tabular XML document can
then transformed or used to easily render tables (for example in HTML or in
the console).

Tabular is better than spreadsheets.

Documentation
-------------

See the [official documentation](http://tabular.readthedocs.org).

Example
-------

The central concept is the definition file:

```javascript
{
"rows": [
{
"cells": [
{
"name": "title",
"expr": "string(./title)"
},
{
"name": "price",
"expr": "number(./price)"
}
],
"with_query": "//book"
},
{
"cells": [
{
"name": "price",
"expr": "sum(//price)"
}
]
}
]
}
````

The above definition will generate a table representation in XML with a row
for each `` element in the given XML file and provide an additional row
showing the sum of all the `` elements of the `` element.

So given the following XML file:

```xml



War and Peace
5.00


One Hundered Years of Soliture
7


````

The generated table might look like this (as rendered by the [Tabular
CLI](https://github.com/phpbench/tabular-cli)):

```
┌────────────────────────────────┬───────┐
│ title │ price │
├────────────────────────────────┼───────┤
│ War and Peace │ 5 │
│ One Hundered Years of Soliture │ 7 │
│ │ 12 │
└────────────────────────────────┴───────┘
```