Source string Read only

(itstool) path: sect3/para
113/1130
Context English State
The marked section is finished by closing the two square brackets, and then returning to the document context from the <acronym>XML</acronym> context with <literal>&gt;</literal>.
Marked Section Keywords
<literal>CDATA</literal>
These keywords denote the marked sections <emphasis>content model</emphasis>, and allow you to change it from the default.
When an <acronym>XML</acronym> parser is processing a document, it keeps track of the <quote>content model</quote>.
The content model describes the content the parser is expecting to see and what it will do with that content.
The <literal>CDATA</literal> content model is one of the most useful.
<literal>CDATA</literal> is for <quote>Character Data</quote>. When the parser is in this content model, it expects to see only characters. In this model the <literal>&lt;</literal> and <literal>&amp;</literal> symbols lose their special status, and will be treated as ordinary characters.
When using <literal>CDATA</literal> in examples of text marked up in <acronym>XML</acronym>, remember that the content of <literal>CDATA</literal> is not validated. The included text must be check with other means. For example, the content could be written in another document, validated, and then pasted into the <literal>CDATA</literal> section.
Using a <literal>CDATA</literal> Marked Section
<tag class="starttag">para</tag>Here is an example of how to include some text that contains
many <tag class="starttag">literal</tag>&amp;lt;<tag class="endtag">literal</tag> and <tag class="starttag">literal</tag>&amp;amp;<tag class="endtag">literal</tag>
symbols. The sample text is a fragment of
<tag class="starttag">acronym</tag>XHTML<tag class="endtag">acronym</tag>. The surrounding text (<tag class="starttag">para</tag> and
<tag class="starttag">programlisting</tag>) are from DocBook.<tag class="endtag">para</tag>

<tag class="starttag">programlisting</tag>&lt;![CDATA[<tag class="starttag">p</tag>This is a sample that shows some of the
elements within <tag class="starttag">acronym</tag>XHTML<tag class="endtag">acronym</tag>. Since the angle
brackets are used so many times, it is simpler to say the whole
example is a CDATA marked section than to use the entity names for
the left and right angle brackets throughout.<tag class="endtag">p</tag>

<tag class="starttag">ul</tag>
<tag class="starttag">li</tag>This is a listitem<tag class="endtag">li</tag>
<tag class="starttag">li</tag>This is a second listitem<tag class="endtag">li</tag>
<tag class="starttag">li</tag>This is a third listitem<tag class="endtag">li</tag>
<tag class="endtag">ul</tag>

<tag class="starttag">p</tag>This is the end of the example.<tag class="endtag">p</tag>]]&gt;<tag class="endtag">programlisting</tag>
<literal>INCLUDE</literal> and <literal>IGNORE</literal>
When the keyword is <literal>INCLUDE</literal>, then the contents of the marked section will be processed. When the keyword is <literal>IGNORE</literal>, the marked section is ignored and will not be processed. It will not appear in the output.
Using <literal>INCLUDE</literal> and <literal>IGNORE</literal> in Marked Sections
&lt;![INCLUDE[
This text will be processed and included.
]]&gt;

&lt;![IGNORE[
This text will not be processed or included.
]]&gt;
By itself, this is not too useful. Text to be removed from the document could be cut out, or wrapped in comments.
It becomes more useful when controlled by <link linkend="xml-primer-parameter-entities">parameter entities</link>, yet this usage is limited to entity files.
For example, suppose that documentation was produced in a hard-copy version and an electronic version. Some extra text is desired in the electronic version content that was not to appear in the hard-copy.
Create an entity file that defines general entities to include each chapter and guard these definitions with a parameter entity that can be set to either <literal>INCLUDE</literal> or <literal>IGNORE</literal> to control whether the entity is defined. After these conditional general entity definitions, place one more definition for each general entity to set them to an empty value. This technique makes use of the fact that entity definitions cannot be overridden but the first definition always takes effect. So the inclusion of the chapter is controlled with the corresponding parameter entity. Set to <literal>INCLUDE</literal>, the first general entity definition will be read and the second one will be ignored. Set to <literal>IGNORE</literal>, the first definition will be ignored and the second one will take effect.
Using a Parameter Entity to Control a Marked Section
&lt;!ENTITY % electronic.copy "INCLUDE"&gt;

&lt;![%electronic.copy;[
&lt;!ENTITY chap.preface SYSTEM "preface.xml"&gt;
]]&gt;

&lt;!ENTITY chap.preface ""&gt;
When producing the hard-copy version, change the parameter entity's definition to:
&lt;!ENTITY % electronic.copy "IGNORE"&gt;
Modify <filename>entities.ent</filename> to contain the following:
&lt;!ENTITY version "1.1"&gt;
&lt;!ENTITY % conditional.text "IGNORE"&gt;

&lt;![%conditional.text;[
&lt;!ENTITY para1 SYSTEM "para1.xml"&gt;
]]&gt;

&lt;!ENTITY para1 ""&gt;

&lt;!ENTITY para2 SYSTEM "para2.xml"&gt;
&lt;!ENTITY para3 SYSTEM "para3.xml"&gt;
Normalize <filename>example.xml</filename> and notice that the conditional text is not present in the output document. Set the parameter entity guard to <literal>INCLUDE</literal> and regenerate the normalized document and the text will appear again. This method makes sense if there are more conditional chunks depending on the same condition. For example, to control generating printed or online text.
Conclusion
That is the conclusion of this <acronym>XML</acronym> primer. For reasons of space and complexity, several things have not been covered in depth (or at all). However, the previous sections cover enough <acronym>XML</acronym> to introduce the organization of the <acronym>FDP</acronym> documentation.
<acronym>XHTML</acronym> Markup
Introduction
This chapter describes usage of the <acronym>XHTML</acronym> markup language used for the FreeBSD web site.

Loading…

No matching activity found.

Browse all component changes

Glossary

English English
No related strings found in the glossary.

Source information

Source string comment
(itstool) path: sect3/para
Flags
read-only
Source string location
book.translate.xml:3346
String age
a year ago
Source string age
a year ago
Translation file
books/fdp-primer.pot, string 558