xlf (Xibo Layout Format) parser
#include <xlfparser/xlfparser.h>
int main() {
xlfNode *node;
int num_region, num_tag;
const char *filepath = "/tmp/file.xlf";
node = xlfparser_parse_file(filepath, &num_region, &num_tag);
if(node == NULL) {
/* ouch cannot parse the file */
return -1;
}
// from here, we almost get everything we need
Layout *layout = xlfparser_get_layout(node);
// here we go, we got everything we need here.
// access layout attributes
// layout->width
// layout->height
// layout->bgcolor
// etc..
// get the first region from layout.
Region *region = xlfparser_get_region(layout, 0);
// access region attributes
// region->width
// region->left
// region->top
// etc..
// get the first media from region
Media *media = xlfparser_get_media(region, 0);
// access media attributes
// media->id
// media->type
// media->duration
// etc..
// finally, don't forget to delete the layout
return xlfparser_delete_layout(layout);
}
Either one, but not both, if both libs are available on your system use one of the following during build.
cmake [source-dir] -DPREFER_LIBROXML=1
cmake [source-dir] -DPREFER_LIBXML2=1
- clone
git clone https://github.com/ajiwo/xlfparser-c
- build
cd xlfparser-c
mkdir build
cd build
cmake ..
# or
# cmake .. -DPREFER_LIBROXML=1
# to explicitly choose libroxml
# or
# cmake .. -DPREFER_LIBXML2=1
# to explicitly choose libxml2
make
- install
sudo make install