Ir al contenido
Otras versiones

Cargando…

Metadata XML definition

Esta página aún no está disponible en tu idioma.

The application metadata is based on a formal XML definition. The DTD ( Document Type Definition ) defines the structure and the legal elements and attributes of an XML document.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN"
"http://www.openkm.com/dtd/property-groups-3.10.dtd">
<property-groups>
</property-groups>
  • The DOCTYPE is a formal definition of a DTD. In the previous example, the DOCTYPE is property-groups-3.10.dtd.
  • The XML begins with tag and ends with . Within this hierarchy, the metadata groups are defined.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN"
"http://www.openkm.com/dtd/property-groups-3.10.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
</property-group>
</property-groups>
  • Each  …</property-group  block identifies the beginning and end of a new metadata group definition.
  • Each metadata group has a label - used by the user interface - Consulting.
  • Each metadata group has a unique name, okg:consulting.
  • The metadata group name must always start with “okg:” ( OpenKM Group ).
  • Do not use special characters in the name.
Attribute Description Required
label The text shown as a label in the user interface. true
name Unique field identifier.
Two metadata groups cannot have the same name. The name must be unique.
The name must start with “okg:”.
Please use only letters, numbers, and underscore: “0-9a-zA-Z_”.
true
visible Show or hide the metadata.
Allowed values are:
- true.
- false.
By default, the metadata are visible.
false
readonly Metadata values cannot be modified from the user interface, only from the API.
Allowed values are:
- true.
- false.
By default, the metadata are modifiable.
false
defaultValueClassName Set a custom Java class for setting initial default values. false

Available field types:

  • Checkbox
  • Input
  • Iframe
  • Select
  • Separator
  • Suggestbox
  • Text
  • TextArea

More information about field type elements is available at Metadata fields

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN"
"http://www.openkm.com/dtd/property-groups-3.10.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<input label="Input label" name="okp:consulting.input1" />
<separator label="Separator label" name="okp:consulting.separator" />
<input label="Input label" name="okp:consulting.input2" />
</property-group>
</property-groups>

If the server has no access to the Internet, then the DTD file must be accessible in some way; for example, you can store a copy on your application server.

<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN"
"file:///home/openkm/property-groups-3.10.dtd">
  • In the example, /home/openkm/property-groups-3.10.dtd is the file system path to the file.

When you register a new metadata definition in OpenKM, the metadata values are stored in two separate tables. One table is for current metadata values and the other is for historical metadata values.

Sample:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN"
"http://www.openkm.com/dtd/property-groups-3.10.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<input label="Input label" name="okp:consulting.input1" />
<separator label="Separator label" name="okp:consulting.separator" />
<input label="Input label" name="okp:consulting.input2" />
</property-group>
</property-groups>

After registering the previous metadata definition, two tables will be created with these columns:

  • OKM_PGRP_CUR_CONSULTING ( used for current metadata values )
    • RGT_UUID: ID of the node which has this metadata
    • RGT_PRO_INPUT1: Value of property okp:consulting.input1 
    • RGT_PRO_INPUT2: Value of property okp:consulting.input2
    • RGT_PRO_SEPARATOR: Value of property okp:consulting.separator
  • OKM_PGRP_HIS_CONSULTING ( used for historical metadata values )
    • RGT_UUID: ID of the node which has this metadata
    • RGT_VERSION: ID of the related version
    • RGT_PRO_INPUT1: Value of property okp:consulting.input1
    • RGT_PRO_INPUT2: Value of property okp:consulting.input2
    • RGT_PRO_SEPARATOR: Value of property okp:consulting.separator

Default column size by type:

Type Size
Input 128 characters
Select 128 characters
SuggestBox 128 characters
TextArea 256 characters

If you have larger metadata values, you should increase the value of the column using the attribute “dbColumnSize”. See the sample below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN"
"http://www.openkm.com/dtd/property-groups-3.10.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<input label="Input label" name="okp:consulting.input1" dbColumnSize="256"/>
<separator label="Separator label" name="okp:consulting.separator" />
<input label="Input label" name="okp:consulting.input2" dbColumnSize="512"/>
</property-group>
</property-groups>