Data
C3 can use data in XML or HTML (xHTML) format. The data source can be a xml file or any system like a data base that deliver data as xml. The source are defined in C3 settings and are called a data connector.
Basics
With C3 you can place data in a document and the data are transformed in to a document object like a text.
Data must be transformed to a Type of object. eg Text, Table or Image.
C3 use the Sequence of the content. Like the order of text paragraphs.
- C3 uses the
Value
of the data. - All data must have a unique
id
. ID is used for links.
To be able to create a better end result you can also add styling on text, tables and images. For this C3 uses class
witch refers to InDesign Styles.
XML or HTML
C3 can use data as XML or HTML. Element names in HTML is defined as standard:
<p>
is a paragraph with some text.<table>
is a table etc.
Element names in XMl can be custom:
<info>Some text
<group>More text
Mapper
In the settings you can decide how the data are delivered to C3.
- As HTML.
- As XML (RAW).
ID
To be able to create a link to the data you must provide a unique ID. Use the attribute ctrlid
.
Label
You must also include a label in the data, this is what's shown in the browser tree. Use the attribute label
.
Basic rules:
- First row in a xml file must be
<?xml version="1.0" encoding="UTF-8"?>
- Then a root element like
<root label="My Data">
plus</root>
- Inside the root some data like this
<p ctrlid="1" >Some Text</>
.
First example
Some minimal data can look like this:
<?xml version="1.0" encoding="UTF-8"?>
<root label="Basic data">
<section label="News" ctrlid="10">
<art type="article" ctrlid="100" label="My Article">
<p class='Head'>Heading</p>
<p class="Body">Lorum Ipsum bla bla bla...</p>
</art>
</section>
</root>
Structure- or content elements
In the data there can be two types of elements:
- Structure: Elements that groups data. Build a tree structure in the browser tree.
- Content: Elements that are the real content of the document, like text.
Icons
Different types of elements have different icons. For example a data base or a book. The icon are selected from the attribute type
or if missing the element name. There are a number of default icons and custom icons can be added.
<book>My Book</book>
<root type='book'>My book</root>
Structure
The main purpose of a structure is to divide and organize data in a user friendly way.
C3 shows the data structure as a tree in the browser.
If you use HTML then all structure element needs to have the type
attribute.
Structure can be nested in sub structures. The different structure elements you can use in html is:
library
, book
, chapter
, article
. Example of data with some structure:
<?xml version="1.0" encoding="UTF-8"?>
<root type="library" label="Structure of data">
<div type="book" label="Book" ctrlid="10">
<div type="chapter" label="Chapter" ctrlid="20">
<div type="article" ctrlid="100" label="My Article">
<whatever type='para' class='Head'>Heading</p>
<p class="Body">Lorum Ipsum bla bla bla...</p>
</div>
</div>
</div>
</root>
ctrlid
is an important attribute in a structure. Elements without ctrlid
are not displayed in the browser.
Attribute
C3 uses some specific attributes.
Common attributes
These attributes are common for most of the elements.
ctrlid
= A unique id used to create a link to. Id must exist on all elements that should be linked.label
= The text displayed in the browser. Should exist on all levels that are displayed in the browser.type
= The type of element.class
= Set the style of eg. a paragraph. If no class is used the data gets the document default style. If you set a class that's not included in the document, C3 creates one.
Then there are some attributes that is specific to the type of data. med eller utan %
width
= The width of a table, column, cell or image.height
= The height of a row, cell or image.href
= Links in text or to a image. A link of the type Http, Mail or File.
Size
The attributes width
and height
refer to a size. Sizes can be set in this ways:
width="50%"
For example an image with 50% of the text frame with, it are placed in.width="50mm"
An image that are exactly 50 millimeters wide.width="50"
50 without unit, the C3 uses the document default unit.
Language
You can set the language of the data via the attribute lang
plus a 2 or 4 digit ISO code. Exempelvis
lang="se"
lang="se_SV"
If you only set lang
on the root element C3 assumes that all sub content have the same language. Language set on a sub level makes it possible to provide data in different languages.
Element with document content
Elements with content that should be placed and linked in the document can be of different types. Depending on if you use HTML or XML the examples looks a bit different, choose the one that suits you best.
Two ways of deliver data xml and html.
<art type="article" ctrlid="100" label="Article with my own element names">
<whatever type='para' class='Head'>Heading</whatever>
<another type='para' class='Body'>Text and more text</another>
</art>
<div type="article" ctrlid="100" label="Article with HTML names">
<p class='Head'>Heading</p>
<p class='Body'>Text and more text</p>
</div>
Text
C3 can use paragraphs or characters. In HTML <p>
and <span>
. Styling is controlled by class
. InDesign styling=class and can be paragraph- or character style. HTML Text elements:
<p>
Paragraph<span>
One or many characters within a paragraph<ul>
Bullet list<ol>
Number list
Data example.
<p class="Heading">My heading</p>
<p class="Body">My text line.</p>
<p class="Body">My <span class="Bold">Fat</span> line.</p>
<p>Text with no style will get default style</p>
<description type="para" class="Body">Text with custom element name.</description>
<p class="Body">
<ul>Bullet 1</ul>
<ul>Bullet 2</ul>
</p>
Text with links.
<p class="Heading">Text with link</p>
<p class="Body">My text line.</p>
<p class="Body">Please <span href="httl://www.istone.com">Click</span> me.</p>
<p class="Body">Please <span href="mail://[email protected]">send a mail</span> to me.</p>
Tables
Both XML and HTML tables have the following parts.
- Table
- Rows head-, body- and footer
- Columns
- Cell
Basic table in HTML.
<table class="TableStyle">
<tr>
<td type="cell" class="headerCell">Basic</td>
<td type="cell" class="headerCell">Table</td>
<td type="cell" class="headerCell">Example</td>
</tr>
<tr>
<td type="cell" class="cellStyle">cell1</td>
<td type="cell" class="cellStyle">cell2</td>
<td type="cell" class="cellStyle">cell3</td>
</tr>
<tr>
<td type="cell" class="cellStyle">cell4</td>
<td type="cell" class="cellStyle">cell5</td>
<td type="cell" class="cellStyle">cell6</td>
</tr>
<tr>
<td type="cell" class="cellStyle">Footer1</td>
<td type="cell" class="cellStyle">Footer2</td>
<td type="cell" class="cellStyle">Footer3</td>
</tr>
</table>
Table and HTML attributes:
width
= Table / Column widthclass
= Table / Cell stylerows
= The number of rowscols
= The number of columnstype
= Element type. table, hrow, row, frow, cell, .table
= Tablecolgroup
= A groupe of columnscol
= Columntr
= Rowth
= Cell in Headtd
= Cell in Bodycolspan
= Merge this and # number of cells horizontal.rowspan
= Merge this and # number of cells vertical.
Table with misc. attributes.
<table class="AdvancedTable" width="80%">
<colgroup>
<col width="50%"/>
<col width="25%"/>
<col width="25%"/>
</colgroup>
<th type="hrow">
<td type="cell" class="headerCell" span="2">Table</td>
<td type="cell"></td>
<td type="cell" class="headerCellR">Example</td>
</th>
<tr>
<td type="cell" class="cellStyle">cell1</td>
<td type="cell" class="cellStyle">cell2</td>
<td type="cell" class="cellStyle">cell3</td>
</tr>
<tr>
<td type="cell" class="cellStyle">cell4</td>
<td type="cell" class="cellStyle">cell5</td>
<td type="cell" class="cellStyle">cell6</td>
</tr>
<tr type="frow">
<td type="cell" class="cellStyle">Footer1</td>
<td type="cell" class="cellStyle">Footer2</td>
<td type="cell" class="cellStyle">Footer3</td>
</tr>
</table>
Tables in RAW-XML format
A table can also be created in xml format: This is an example with a bike. The properties are represented by a row in the table.
Prop. | value |
---|---|
Weight | 5 kg |
Color | Red |
The data looks like this:
<root type="database" label="Bikes">
<chapter ctrlid="01" label="All bikes">
<bike ctrlid="11" label="11 Red Bike">
<artno>11</artno>
<name>Red Bike</name>
<features>
<feature>
<prop>Weight</prop>
<val>5 kg</val>
</feature>
<feature>
<prop>Color</prop>
<val>red</val>
</feature>
</features>
</bike>
</chapter>
</root>
In InDesign you create a table template. When you place data every property are repeated as a table row, property and value are inserted in cells.
Images
C3 can also place images. For images we use the object style as class. Image example data.
<img type="img" href="forlan.jpg" width="100" height="200"/>
<img type="img" href="forlan.jpg" width="100%"/>
<img type="img" href="maradona.jpg" width="200" height="200" class="ImageStyle"/>
Path
In the C3 settings you can set a default path. If data contains a filename without path, the image must be placed in the same folder as the document. But you can also use relative paths:
- href="subfolder/example.jpg"
- href="subfolder/nextfolder/example.jpg"
- href="subfolder\nextfolder\example.jpg"
Also this kind of paths can be used:
- href="C:\main\images\example.jpg"
Image sizes:
Images often have to be used with som kind of size. If no size are provided C3 use the size from the image file (1:1).
If only width
is set, the height are set proportionally, the same goes for height
.