kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 2 | <!--Arbortext, Inc., 1988-2006, v.4002-->
|
| 3 | <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
|
| 4 | "task.dtd">
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 5 | <task id="tedtcnst" xml:lang="en-us">
|
| 6 | <title>Editing with DTD or XML schema constraints</title>
|
| 7 | <titlealts>
|
| 8 | <searchtitle>Editing with DTD or XML schema constraints</searchtitle>
|
| 9 | </titlealts>
|
| 10 | <shortdesc>In the Design view, when you edit an XML file that has a set of
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 11 | constraints or rules defined by a DTD or an XML schema, you can turn the constraints
|
| 12 | on and off to provide flexibility in the way you edit, but still maintain
|
| 13 | the validity of the document periodically.</shortdesc>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 14 | <prolog><metadata>
|
kprice | 9623e9d | 2007-05-03 03:43:05 +0000 | [diff] [blame] | 15 | <keywords><indexterm>XML editor<indexterm>editing with constraints</indexterm></indexterm>
|
| 16 | <indexterm>XML files<indexterm>editing with constraints</indexterm></indexterm>
|
| 17 | </keywords>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 18 | </metadata></prolog>
|
| 19 | <taskbody>
|
| 20 | <context><p> When the constraints are turned on, and you are working in the
|
| 21 | Design view, the XML editor prevents you from inserting elements, attributes,
|
| 22 | or attribute values not permitted by the rules of the XML schema or DTD, and
|
| 23 | from removing necessary or predefined sets of tags and values. In this mode,
|
| 24 | an element's content must be valid to use the XML editor's guided editing
|
| 25 | options.</p><p>You might want to turn the constraints off for an XML file
|
| 26 | if you need more flexibility. For example, you want to try working with elements
|
| 27 | or attributes not permitted by the associated DTD or XML schema, without actually
|
| 28 | removing the association with the DTD or XML schema.</p><p>To turn the constraints
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 29 | for an XML file off, click <menucascade><uicontrol>XML</uicontrol><uicontrol>Turn
|
| 30 | Grammar Constraints Off</uicontrol></menucascade> in the toolbar. After you
|
| 31 | have turned the constraints off for a file, you can insert or delete any element
|
| 32 | or attribute regardless of the DTD or XML schema rules. You can create new
|
| 33 | elements or attributes that are not in the DTD or schema - these Design view
|
| 34 | prompts will only appear when you have turned constraints off. The file might
|
| 35 | not be valid, however, if you do this. </p><p>The following example shows
|
| 36 | what you can do if you turn the constraints of a DTD off:</p></context>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 37 | <steps>
|
| 38 | <step><cmd>Open the XML file in the XML editor (right-click the file in the
|
| 39 | Navigator view and click <uicontrol>Open With > XML Editor</uicontrol>). </cmd>
|
| 40 | </step>
|
| 41 | <step><cmd>You have a DTD that specifies that an element requires at least
|
| 42 | one of a specific child element: </cmd><info><codeblock><!ELEMENT parentElement (childElement+)>
|
| 43 | </codeblock></info></step>
|
| 44 | <step><cmd>If, in an XML file associated with your DTD, you attempt to remove
|
| 45 | the final child element of the element with the DTD constraints turned on,
|
| 46 | the editor will not allow you to do this, as it will make the document invalid.</cmd>
|
| 47 | <info>You can confirm this by using the element's pop-up menu to verify that
|
| 48 | the <uicontrol>Remove</uicontrol> option is grayed out.</info></step>
|
| 49 | <step><cmd>To turn the DTD constraints off, click <uicontrol>XML > Turn Grammar
|
| 50 | Constraints Off</uicontrol>. </cmd></step>
|
| 51 | <step><cmd>If you attempt to remove the same child element with constraints
|
| 52 | off, the editor will allow you to.</cmd></step>
|
| 53 | <step><cmd>To correct the invalid document, you will have to re-add the necessary
|
| 54 | element, or remove the invalid tagging or value.</cmd></step>
|
| 55 | </steps>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 56 | <result><?Pub Caret?><p>If you introduce errors into your files, you must
|
| 57 | save and validate the file in order to see a list of the errors you have introduced.
|
| 58 | They will be listed in the Problems view. After you fix the errors, you must
|
| 59 | save and validate your file again to see if the file is now valid.</p><p>These
|
| 60 | instructions were written for the Resource perspective, but they will also
|
| 61 | work in many other perspectives.</p></result>
|
kprice | ef16068 | 2006-08-29 18:08:31 +0000 | [diff] [blame] | 62 | </taskbody>
|
| 63 | </task>
|
kprice | b59c9f6 | 2008-04-02 21:24:37 +0000 | [diff] [blame] | 64 | <?Pub *0000003814?>
|