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.
- Host: GitHub
- URL: https://github.com/phpbench/tabular
- Owner: phpbench
- Created: 2015-08-16T14:44:33.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-18T09:26:00.000Z (about 10 years ago)
- Last Synced: 2025-04-16T03:56:12.192Z (10 months ago)
- Language: PHP
- Homepage:
- Size: 654 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Tabular
=======

[](https://travis-ci.org/phpbench/tabular)
[](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 │
└────────────────────────────────┴───────┘
```