At the moment, the rendering model for cainteoir-engine with XML-based documents is to:
call a document-specific parser;
map element names to xml::context::entry objects;
specify the type (span, paragraph, sentence, heading, ...) and style (emphasized, strong, superscript, ...) for the xml::context::entry objects;
use a recursive-decent parser to parse the XML reader events, mapping them to the xml::context::entry types.
This works for simplistic styling and rendering, but:
the rendering model is limited -- it does not support fonts, indentation or more complex styling;
the interpretation of the styles is dependent on the processor -- this leads to duplicate work (e.g. text layout in doc2doc and cainteoir-gtk)
maintenance of the parsers becomes more complex over time;
there is duplicated code in the core processing;
adding/updating the document support requires compiling cainteoir-engine with the updated logic;
it is not easy to support CSS for HTML, SSML and other XML documents.
In order for this to work, the content model must be able to specify the following:
implicit end tags (e.g. for br and img parsing support in HTML);
optional start and/or end tags (for 12.1.2.4 Optional tags support in HTML-WHATWG);
RDF metadata generation (e.g. for RDF/XML and OPF metadata extraction);
table of content, anchors and links (e.g. for NCX support);
document formatting (e.g. HTML/CSS styles and rendering);
text-to-speech formatting (e.g. SSML and CSS3 Speech styles).
The aim is to replace all the current XML-based parsers (XHTML, HTML, NCX, OPF, OCF, RDF/XML, SSML and SMIL) as well as others (DocBook, ODF, MathML, SVG, etc.). These should be selected based on the namespaceUri and rootName and stored in the /usr/shared/cainteoir-engine/formats system directory as style documents.
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1026793-implement-a-proper-style-model-for-xml-based-documents?utm_campaign=plugin&utm_content=tracker%2F254961&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F254961&utm_medium=issues&utm_source=github).
At the moment, the rendering model for
cainteoir-engine
with XML-based documents is to:xml::context::entry
objects;xml::context::entry
objects;xml::context::entry
types.This works for simplistic styling and rendering, but:
doc2doc
andcainteoir-gtk
)cainteoir-engine
with the updated logic;In order for this to work, the content model must be able to specify the following:
br
andimg
parsing support in HTML);12.1.2.4 Optional tags
support in HTML-WHATWG);The aim is to replace all the current XML-based parsers (XHTML, HTML, NCX, OPF, OCF, RDF/XML, SSML and SMIL) as well as others (DocBook, ODF, MathML, SVG, etc.). These should be selected based on the namespaceUri and rootName and stored in the
/usr/shared/cainteoir-engine/formats
system directory as style documents.