Download XML Author 11.2 User Manual for Eclipse

Transcript
Editing documents
Editing XML documents
Associate a schema to a document
Setting a schema for the Content Completion
In case you are editing document fragments, for instance the chapters from a book each one in a separate file, you can
activate the Content Completion for these fragments in two ways:
Setting a default schema
The list of document types available at Options → Preferences -> Document Type Association contains a set of rules
for associating a schema with the current document when no schema is specified within the document. The schema is
one of the types: XML Schema, XML Schema with embedded Schematron rules, Relax NG (XML syntax or compact
syntax), Relax NG (XML syntax) with embedded Schematron rules, Schematron, DTD, NRL, NVDL.
The rules are applied in the order they appear in the table and take into account the local name of the root element, the
default namespace and the file name of the document.
Important
The editor is creating the Content Completion lists by analysing the specified schema and the current context
(the position in the editor). If you change the schema you can observe that the list of tags to be inserted is changing.
Figure 4.8. Content completion driven by DocBook DTD
Adding a Processing Instruction
The same effect is obtained by configuring a processing instruction that specifies the schema to be used. The advantage
of this method is that you can configure the Content Completion for each file. The processing instruction must be added
at the beginning of the document, just after the XML prologue:
<?oxygen RNGSchema="file:/C:/work/relaxng/personal.rng" type="xml"?>
27