What is DITA XML syntax?
Since DITA is a markup language specifically designed for structured technical documentation, it requires the use of content tags called syntax. DITA XML syntax consists of elements and attributes that allow authors to define the structure and semantics of their content.
Topic-Based Authoring
DITA follows a topic-based authoring approach. Content is organized into discrete “topics,” each focusing on a specific subject or task. Topics are the building blocks of DITA documents.
Hierarchical Structure
DITA topics can be organized hierarchically to represent the relationships between different pieces of content. Topics can have parent-child relationships, forming a tree-like structure.
Elements
DITA provides a set of predefined elements that authors use to structure their content. Common elements include <title>, <p> (paragraph), <ul> (unordered list), <ol> (ordered list), <table>, to name a few. These elements define the content’s structure.
Attributes
Attributes provide additional information about elements. DITA allows the use of custom attributes to capture metadata or properties specific to the content. For example, you can define attributes to specify the audience, product version, or any custom classification.
Specialization
DITA is highly extensible through specialization. Organizations can create their custom elements and attributes to meet specific documentation needs. Specialization allows for fine-tuning DITA to match an organization’s content requirements.
Reuse
DITA promotes content reuse. Authors can use techniques like “conref” (content reference) to reuse content from one topic in another. This reduces redundancy and ensures consistency across documents.
Conditional Processing
DITA supports conditional processing, allowing authors to include or exclude content based on conditions. Conditions can be defined using attributes, making it possible to create variations of content for different purposes.
Metadata
Metadata is an integral part of DITA. It provides context and information about content components. Metadata elements capture details like the content’s title, author, audience, and other attributes relevant to content management and retrieval.
Example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="sample-topic">
<title>This is a Sample DITA Topic</title>
<body>
<p>This is the content of the DITA topic. It can include text, lists, tables, and more.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</body>
</topic>