<content>
Summary
The <content> element stores the textual body of a comment in PageSeeder.
Content can be plain text or structured markup (HTML, XML).
If the media type is an XML media type , then the contents of the element are XML. In all other cases, the content is considered plain text.
PageSeeder does not support binary content in comments.
Usage context
| Permitted content | text or XML |
|---|---|
| Permitted parent | <comment> |
Attributes
This element has the following attributes.
| Name | Type | Required | Description |
|---|---|---|---|
| type | string | yes | Media type specifying content format |
| value | string | JSON only | The content body |
type
Specifies the content format using standard media type notation:
top-level type name / [ tree. ] subtype name [ +suffix ]
Requirements:
- Must be a text-based media type (binary types not supported)
- Character encoding parameters are ignored (UTF-8 is assumed)
- Structured content requires an XML-compatible media type
Common values:
text/plainapplication/html+xmlapplication/vnd.example.movie+xml
For structured content, use the +xml suffix (e.g., application/html+xml) rather than the generic application/xmlmedia type.
value
Contains the actual content.
Representation:
- XML format: Direct text content or child elements depending on media type
- JSON format: String property containing text or serialized markup
Examples
XML examples
In XML the content is repeated if there are multiple, a single content element provides the media type and actual content.
Plain text content
This is the default on PageSeeder.
<content type="text/plain">Hello everyone! Please mind the new lines as they may be important in plain text! </content>
HTML content
<content type="application/html+xml"> <p>Hello everyone!</p> <p>Paragraphs are more reliable</p> </content>
XML content
<content type="application/vnd.example.helloworld+xml"> <greeting>Hello World!</greeting> </content>
JSON examples
In JSON, the content is an array of content objects that each have a media type and actual content. The following examples are equivalent the XML examples.
Plain text content
This is the default on PageSeeder.
"content":[{
"type":"text/plain",
"value":"Hello everyone!\n\nPlease mind the new lines as they may be important in plain text!"
}]HTML content
"content":[{
"type":"application/html+xml",
"value":"<p>Hello everyone!</p>
<p>Paragraphs are more reliable</p>"
}]XML content
"content":[{
"type":"application/vnd.example.helloworld+xml",
"value":"<greeting>Hello World!</greeting>"
}]Schema
XML Schema
<xs:element name="content" type="content"/>
<xs:complexType name="content" mixed="true">
<xs:sequence>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="type" type="content-type" use="required"/>
</xs:complexType>
<xs:simpleType name="content-type">
<xs:restriction base="mediatype">
<xs:maxLength value="100"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="mediatype">
<xs:restriction base="xs:string">
<!-- This is actually more restrictive than the MIME format -->
<xs:pattern value="[a-zA-Z0-9_]+/[-._a-zA-Z0-9]+(\+[-._a-zA-Z0-9]+)?"/>
</xs:restriction>
</xs:simpleType>
JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://dev.pageseeder.com/schema/content.json",
"title": "Content",
"description": "The text content of a comment. Used as a container for textual content that can be plain text or XML.",
"type": "object",
"properties": {
"content": {
"type": "array",
"description": "Array of content objects, each with a media type and value",
"items": {
"$ref": "#/$defs/contentItem"
},
"minItems": 1
}
},
"required": ["content"],
"$defs": {
"contentItem": {
"type": "object",
"description": "A single content item with its media type and textual value",
"properties": {
"type": {
"type": "string",
"description": "The media type of the content (e.g., text/plain, application/html+xml)",
"pattern": "^[a-zA-Z0-9_]+/[-._a-zA-Z0-9]+(\\+[-._a-zA-Z0-9]+)?$",
"maxLength": 100,
"examples": [
"text/plain",
"application/html+xml",
"application/vnd.example.movie+xml"
]
},
"value": {
"type": "string",
"description": "The actual content as text or serialized XML. Newlines and formatting should be preserved for plain text."
}
},
"required": ["type", "value"],
"additionalProperties": false
}
},
"additionalProperties": false
}
Compatibility
Stable since initial API release.