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