
<topic>
    <title>Customizing XML Structure - model.xml</title>
    <shortdesc>This file describes contents of XML structure definition file model.xml</shortdesc>
    <body>
        <p>DITA Storm editor is preconfigured to work with DITA XML, but also capable of operating with user-defined XML structure. It could be customized DITA XML or something completely unrelated as XML for invoice handling (see example <xref href='_invoiceDemo.xml' outputclass='javascript'>here</xref>). </p>
        <p>At this moment DITA Storm does not support direct use of DTD or Schema file to control structure of edited XML document. This has to do with performance and size restrictions of browser-based applications. Instead DITA Storm operates by using XML configuration file similar in nature to Schema but besides description of the XML structure it contains additional information such as user-defined actions and presentation details.</p>
        <note>For step-by-step element creation/customizaiton instructions see <xref href='customElements.xml'>this section</xref>.</note>
        <p>For your reference file <tt>DITAStorm/config/model.dtd</tt> contains DTD defintion of the structure of <tt>model.xml</tt>. </p>
    </body>
    <reference>
        <title>model</title>
        <shortdesc>Root element for entire DITA Storm XML structure definition.</shortdesc>
        <refbody>
            <refsyn>
                <codeblock>&lt;!ELEMENT model (element*,editor*)&gt;</codeblock>
            </refsyn>
            <example outputclass='notoplink'>
                <codeblock>&lt;model&gt;
    &lt;element.../&gt;
    ...
    &lt;editor.../&gt;
    ...
&lt;/model&gt;     </codeblock>
            </example>
        </refbody>
    </reference>
    <reference>
        <title>element</title>
        <shortdesc>Describes a single element in the set of all elements supported by the editor.</shortdesc>
        <refbody>
            <refsyn>
                <codeblock>&lt;!ELEMENT element (group*,action*,default?)&gt;</codeblock>
            </refsyn>
            <properties>
                <prophead>
                    <proptypehd>Type</proptypehd>
                    <propvaluehd>Attribute Name</propvaluehd>
                    <propdeschd>Description</propdeschd>
                </prophead>
                <property>
                    <proptype>string</proptype>
                    <propvalue>name</propvalue>
                    <propdesc>Name of the element. (E.g. 'section' or 'p') </propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>title</propvalue>
                    <propdesc>Full name of the element (E.g.'Section' or 'Topic')</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>addToNewButton</propvalue>
                    <propdesc>Adds element to 'New' button in the editor allowing it to be root element of the edited content. (E.g. for Topic)</propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>attributeEditor</propvalue>
                    <propdesc>Name of the attribute editor associated with this element. See 'editor' element. (E.g. 'topic' or 'univ-atts').</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>confirmDelete</propvalue>
                    <propdesc>Enables confirmation on deleting this element. Used primarily on high-level elements such as Section or Topic. </propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>doctypePublicId</propvalue>
                    <propdesc>Will be used to generate public ID for the element if it gets exported on the top level. (E.g. '-//OASIS//DTD DITA Topic//EN' for Topic).</propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>doctypeFile</propvalue>
                    <propdesc>Used to generate path to the file in DOCTYPE section of the output XML document. This element should only contain file name without the path. (E.g. 'topic.dtd' for DITA Topic).</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>toolbarOnly</propvalue>
                    <propdesc>Indication to only show element on the DITA Storm toolbar (E.g. for Bold or Italic).</propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>toolbarHTML</propvalue>
                    <propdesc>HTML snippet to be used on the toolbar to render the element. Element will not be added to the toolbar if this attribute is not defined. (E.g. 'B' for bold).</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>applyToSelection</propvalue>
                    <propdesc>Indicates whenever to allow element to be 'applied' to the selection. (E.g. set to true for Bold or Note).</propdesc>
                </property>
                <property>
                    <proptype>character</proptype>
                    <propvalue>ctrlShortcut</propvalue>
                    <propdesc>If defined sepcifies keyboard key which can be used with Control (Ctrl) key to insert element into the content. (E.g. by default set to 'b' on Bold and to 'i' on Italic element).</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>enableUnwrap</propvalue>
                    <propdesc>Enables 'unwrap' functionality when element can be replaced by its content. (E.g. by default enabled for Note, Paragraph and Bold).</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>inline</propvalue>
                    <propdesc>A hint to the editor on how to better format output XML. Inline elements just flow with the text others (block) elements always represent rectangle. (E.g. inline elements are Bold and Quote, block elements are Note and Long Quote).</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>showPropsOnInsert</propvalue>
                    <propdesc>Makes editor to show property dialog when element just gets inserted (E.g. for XRef and Image DITA Elements).</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>genericRenderer</propvalue>
                    <propdesc>Makes editor to use 'generic' element renerer similar to the one in Outline mode. Setting this attribute to 'true' disables XSL styles defined for this element.</propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>helpUrl</propvalue>
                    <propdesc>Location (URL) of the help page for this XML element.</propdesc>
                </property>
                <property>
                    <proptype>true | false </proptype>
                    <propvalue>hidden </propvalue>
                    <propdesc>Removes element from Insert menues of the editor but does not prohibit from actually creating or handling an element from XML source or original XML document.</propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>lock </propvalue>
                    <propdesc>Attribute defining editor-wide lock (or readonly) behavior for all elements of this type. See <xref href='readonly.xml'>this section</xref> for more information and available values. </propdesc>
                </property>
            </properties>
            <example outputclass='notoplink'>
                <codeblock>&lt;element name='topic' 
	title='Topic' 
	addToNewButton='true' 
	attributeEditor='topic'
	doctypePublicId='-//OASIS//DTD DITA Topic//EN'
	doctypeFile='topic.dtd'
	confirmDelete='true'&gt;   
  &lt;group allows='title' card='1'/&gt; 
  &lt;group allows='shortdesc'/&gt;
  &lt;group allows='prolog'/&gt;
  &lt;group allows='body'/&gt; 
  &lt;group allows='related-links'/&gt;
  &lt;group allows='topic,task,concept,reference' card='0..n'/&gt;
  &lt;default&gt;&lt;![CDATA[&lt;topic&gt;&lt;title/&gt;&lt;shortdesc/&gt;&lt;body&gt;&lt;p/&gt;&lt;/body&gt;&lt;/topic&gt;]]&gt;&lt;/default&gt;
&lt;/element&gt;   </codeblock>
            </example>
        </refbody>
    </reference>
    <reference>
        <title>group</title>
        <shortdesc>Represents group of childs of enclosing element. Group elements are ordered and can not contain repetitive elements.</shortdesc>
        <refbody>
            <refsyn>
                <codeblock>&lt;!ELEMENT group EMPTY&gt;</codeblock>
            </refsyn>
            <properties>
                <prophead>
                    <proptypehd>Type</proptypehd>
                    <propvaluehd>Attribute Name</propvaluehd>
                    <propdeschd>Description</propdeschd>
                </prophead>
                <property>
                    <proptype>string</proptype>
                    <propvalue>allows</propvalue>
                    <propdesc>A comma-separated list of child elements allowed by this element. The order of the elements is <b>not</b> significant. Order of the groups <b>is</b>. One of the elements could be "#text" which indicates that element could cnotain text. (E.g. for Title: '#text,b,u,i,tt,sup,sub...')</propdesc>
                </property>
                <property>
                    <proptype>0..1 | 0..n | 1 | 1..n</proptype>
                    <propvalue>card</propvalue>
                    <propdesc>Cardinality of the elements in the group. 0..1 - group can contain no or one of the elements defiend in 'allows' atttribute. 1 - group should contain only one element from the elements in the 'allows' attribute.</propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>emptyText</propvalue>
                    <propdesc>Text which will be displayed if element contains no childs. For example 'empty title' when contents of Title element is empty.</propdesc>
                </property>
                <property>
                    <proptype>true | false</proptype>
                    <propvalue>preserveTextFormatting</propvalue>
                    <propdesc>Indicates that text formatting needs to be preserved. (E.g. in 'pre' and 'code' DITA elements).</propdesc>
                </property>
            </properties>
            <example outputclass='notoplink'>
                 Lets take for example following DTD definition of the Topic and see how it gets translated to model.xml 
                <codeblock>&lt;!ELEMENT topic (title,body?,(topic|reference|concept|task)*)&gt;</codeblock>
                 here is the equivalent defined in model.xml: 
                <codeblock>&lt;element name='topic' ...&gt;
    &lt;group allows='title' card='1'/&gt; 
    &lt;group allows='body' card='0..1'/&gt;
    &lt;group allows='topic,reference,concept,task' card='0..n'/&gt;
&lt;/element&gt;        </codeblock>
            </example>
        </refbody>
    </reference>
    <reference>
        <title>default</title>
        <shortdesc>Defines fragment of XML which will be used to populate newly created element. For example for convenience UL should be created with inner LI.</shortdesc>
        <refbody>
            <refsyn>
                <codeblock>&lt;!ELEMENT default (#PCDATA)&gt; </codeblock>
            </refsyn>
            <example outputclass='notoplink'>
                <codeblock>&lt;element ...&gt;
  ...
  &lt;default&gt;&lt;![CDATA[&lt;topic&gt;&lt;title/&gt;&lt;shortdesc/&gt;&lt;body&gt;&lt;p/&gt;&lt;/body&gt;&lt;/topic&gt;]]&gt;&lt;/default&gt;
&lt;/element&gt;                </codeblock>
            </example>
        </refbody>
    </reference>
    <reference>
        <title>editor</title>
        <shortdesc>Describes element attributes and provides editor necessary information to organize editing process. Editor can reuse fields defined in other editor by using &lt;fields.../&gt; element.</shortdesc>
        <refbody>
            <refsyn>
                <codeblock>&lt;!ELEMENT editor (fields|field)*&gt; </codeblock>
            </refsyn>
            <properties>
                <prophead>
                    <proptypehd>Type</proptypehd>
                    <propvaluehd>Attribute Name</propvaluehd>
                    <propdeschd>Description</propdeschd>
                </prophead>
                <property>
                    <proptype>string</proptype>
                    <propvalue>name</propvalue>
                    <propdesc>Name of the attribute editor.</propdesc>
                </property>
            </properties>
            <example outputclass='notoplink'>
                <codeblock>&lt;editor name="created"&gt;
    &lt;field attribute="date" title="Creation Date" type="date"/&gt;
    ...
&lt;/editor&gt;</codeblock>
            </example>
        </refbody>
    </reference>
    <reference>
        <title>fields</title>
        <shortdesc>Imports fields defined in a different editor element with specified name. This can be useful to organize commonly used attributes in the groups for later reuse.</shortdesc>
        <refbody>
            <refsyn>
                <codeblock> &lt;!ELEMENT fields EMPTY&gt;</codeblock>
            </refsyn>
            <properties>
                <prophead>
                    <proptypehd>Type</proptypehd>
                    <propvaluehd>Attribute Name</propvaluehd>
                    <propdeschd>Description</propdeschd>
                </prophead>
                <property>
                    <proptype>string</proptype>
                    <propvalue>name</propvalue>
                    <propdesc>Name of the attribute editor to be included at this position.</propdesc>
                </property>
            </properties>
            <example outputclass='notoplink'>
                <codeblock>&lt;editor name="xref"&gt;
    &lt;field attribute="href" title="Hyperlink URL" type="conref"/&gt;
    ...
    &lt;fields name="univ-atts"/&gt;
&lt;/editor&gt; </codeblock>
            </example>
        </refbody>
    </reference>
    <reference>
        <title>field</title>
        <shortdesc>Defines a single attribute editing control. If field is of type 'choice' then 'option' child elements are available to define list of possible attribute values. </shortdesc>
        <refbody>
            <refsyn>
                <codeblock> &lt;!ELEMENT field (option*)&gt;</codeblock>
            </refsyn>
            <properties>
                <prophead>
                    <proptypehd>Type</proptypehd>
                    <propvaluehd>Attribute Name</propvaluehd>
                    <propdeschd>Description</propdeschd>
                </prophead>
                <property>
                    <proptype>string</proptype>
                    <propvalue>attribute</propvalue>
                    <propdesc>Name of the attribute. (E.g: 'href')</propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>title</propvalue>
                    <propdesc>Title of the attribute (E.g. 'Navigation Title' for 'navtitle' attribute).</propdesc>
                </property>
                <property>
                    <proptype>'string' | conref | choice | date | separator</proptype>
                    <propvalue>type</propvalue>
                    <propdesc>Type of the attribute</propdesc>
                </property>
                <property>
                    <proptype>number</proptype>
                    <propvalue>size</propvalue>
                    <propdesc>size of the attribute editing field (applicable for 'string' type)</propdesc>
                </property>
            </properties>
            <example outputclass='notoplink'>
                <codeblock>&lt;editor...&gt;
    &lt;field attribute="href" title="Image URL" type="conref"/&gt;
    &lt;field attribute="alt" title="Alt Text" type="string"/&gt;
    ...
&lt;/editor&gt;                        </codeblock>
            </example>
        </refbody>
    </reference>
    <reference>
        <title>option</title>
        <shortdesc>Describes one of the possible values of attributes/fields defined with type 'choice'.</shortdesc>
        <refbody>
            <refsyn>
                <codeblock>&lt;!ELEMENT option EMPTY&gt;</codeblock>
            </refsyn>
            <properties>
                <prophead>
                    <proptypehd>Type</proptypehd>
                    <propvaluehd>Attribute Name</propvaluehd>
                    <propdeschd>Description</propdeschd>
                </prophead>
                <property>
                    <proptype>string</proptype>
                    <propvalue>title</propvalue>
                    <propdesc>Title of the dropdown value.</propdesc>
                </property>
                <property>
                    <proptype>string</proptype>
                    <propvalue>attribute</propvalue>
                    <propdesc>Actual attribute stored in the field.</propdesc>
                </property>
            </properties>
            <example outputclass='notoplink'>
                <codeblock>&lt;field attribute="align" title="Alignment" type="choice"&gt;
    &lt;option title="" value=""/&gt;
    &lt;option title="Left" value="left"/&gt;
    &lt;option title="Right" value="right"/&gt;
    &lt;option title="Center" value="center"/&gt;
&lt;/field&gt;          
</codeblock>
            </example>
        </refbody>
    </reference>
</topic>

