Custom Table Elements

Oxygen general issues.
dsmith1690
Posts: 12
Joined: Wed Sep 23, 2020 1:42 am

Custom Table Elements

Post by dsmith1690 »

Is it possible to configure Oxygen Editor to recognize custom table elements? For example, that the element "cell" is a table cell rather than "td" or "entry"? If so a pointer to the location in the documentation where this configuration is covered would be appreciated. So far I've come up empty on this. Thank you.
Don
Radu
Posts: 9041
Joined: Fri Jul 09, 2004 5:18 pm

Re: Custom Table Elements

Post by Radu »

Hi Don,
What kind of XML documents are you editing? Are they for a custom vocabulary?
So this question is about editing XML visually in the Author visual editing mode, right?
The Author visual editing mode uses CSS for rendering, as an example for defining table element styles in the CSS you may want to look at this CSS used to render cells for XHTML editing:
OXYGEN_INSTALL_DIR/frameworks/xhtml/css/html_cals_table.css
Basically for "cell" elements you would at least need a CSS selector like:

Code: Select all

cell{
    display:table-cell;
}
for rows and tables:

Code: Select all

rowElementName{
    display:table-row;
}
tableElementName {
  display: table;
}

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dsmith1690
Posts: 12
Joined: Wed Sep 23, 2020 1:42 am

Re: Custom Table Elements

Post by dsmith1690 »

Thanks Radu,

Yes, it's a custom XML vocabulary.
So the only thing that's required is to modify the CSS? I expected that but also thought there might be something internal to the editor that needed configuration so that functionality like table cell split/join etc. would work. Please confirm if we only need to update the CSS.

Thanks again,
Don
Radu
Posts: 9041
Joined: Fri Jul 09, 2004 5:18 pm

Re: Custom Table Elements

Post by Radu »

Hi Don,

If your tables were to obey the CALS table specification things would be simpler and you would require less customization work.

The CSS changes I proposed to define the cells, rows, tables and table groups are the first stage in getting the rendering to work.

Afterwards if your table has column widths, cell and row spans you need two things:

1) Have the cells that span multiple rows or columns properly rendered. Oxygen does this with Java extensions implemented at framework level.
If your tables look like HTML tables, DocBook tables (which obey the CALS table specification) or TEI XML tables, Oxygen should handle this without the need for you to implement the column span provider in Java.
So for example if you have this XML:

Code: Select all

<root>
    <table rows="3" cols="2">
        <head>title</head>
        <row role="label">
            <cell cols="2">a</cell>
        </row>
        <row>
            <cell rows="2">b</cell>
            <cell>c</cell>
        </row>
        <row>
            <cell>d</cell>
        </row>
    </table>
</root>
and this CSS:

Code: Select all

root, head {
    display:block;
}

table {
    display: table;
}

row {
    display:table-row;
}
cell {
    display:table-cell;
    border:1px solid black;
}
Oxygen will properly display the cells spanning horizontally and vertically because the table adheres to the TEI XML standard.
If your table uses other attributes rather than "cols" and "rows" to define spans, then you will need to implement some Java extensions to tell Oxygen the necessary information to display the table.

Have you implemented a custom "Document type association" framework configuration in the Oxygen Preferences->"Document Type Association" page? Such a framework extension can contribute Java extensions to control table rendering.
https://www.oxygenxml.com/doc/versions/ ... ement.html

2) Create custom Author actions to insert columns, rows, join and split cells, this older blog post discusses how to implement Author actions similar to what our DocBook XML editing offers:
https://blog.oxygenxml.com/topics/addin ... ework.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
dsmith1690
Posts: 12
Joined: Wed Sep 23, 2020 1:42 am

Re: Custom Table Elements

Post by dsmith1690 »

Thank you, Radu.
Yes, the customer wants a custom table vocabulary. I think the info you have provided is what we need.
Don
Post Reply