Updating the Tree Representation of a Sample Document
This section provides instructions for updating the DOM tree representation of the
You should have already performed the steps in Updating the Schema of a Sample Document. Each of the following topics contains instructions for editing the sample XML document. You should perform the steps in each topic before you move on to the next topic. After the first topic, some steps depend on actions you performed in a previous topic.
This section includes the following topics:
Adding an Element to a Sample Document Tree
To add an element to the tree representation of your-quotes.xml:
1. If it is not already open, open
See Opening a Sample XML Document if you need help with this step.
2. At the bottom of the XML Editor window, click the Tree tab.
Stylus Studio closes the Properties window.
3. Click the plus sign next to the
4. Click New Element in the left tool bar to add a
Stylus Studio displays a drop-down menu that lists the elements you can add at that position in the tree.
5. Click quote and press Enter.
Stylus Studio displays a field next to the new
6. Click outside the field to close it without entering data.
Changing an Element's Data in a Sample Document Tree
In the Tree tab of your-quotes.xml, to change the data that an element contains:
1. Expand the third quote element.
2. Click the symbol element.
3. In the XML Editor top tool bar, click Change Value .
Stylus Studio activates the field to the right of the symbol element and selects the current value.
4. In the active field, type
5. To the right of the exchange element, right-click Nasdaq NMS.
Stylus Studio displays a shortcut menu.
6. Click Change Value. Stylus Studio activates the value field for the
7. In the active field, type
Adding Attributes and Other Node Types to a Sample Document Tree
To add attributes and other types of nodes to your-quotes.xml:
1. Click the last quote element in the tree.
2. Click New Attribute .
Stylus Studio displays an attribute name field immediately below the selected
3. In the attribute name field, type
Stylus Studio displays a default value for the attribute,
4. In the attribute value field, type
Stylus Studio displays an entry field for a new attribute name, allowing you to easily add a number of attributes, one after the other.
5. Click outside the attribute name field to close it.
6. In the XML editor top tool bar, click Validate Document .
Stylus Studio displays a message in the
Output window that indicates that the document is not valid. The DTD does not specify the
7. Click the agent attribute.
8. In the XML Editor top tool bar, click Delete Node .
9. Click Validate Document again.
Stylus Studio displays a message in the Output window that indicates that the document is now valid.
Adding an Entity Reference to a Sample Document Tree
To add an entity reference to your-quotes.xml:
1. If it is not already selected, click the quote element you defined in the previous topic.
2. In the left tool bar, click New Element to add subelements to the new
Stylus Studio displays a drop-down menu that lists a number of elements that you can insert at this point. Scroll the list to view them all.
3. Click company, which is first in the list, and press Enter.
Stylus Studio displays a field next to the element name. You can enter data here, such as the name of the company. But rather than entering data, suppose you want to refer to an entity. To refer to an entity:
4. Click outside the field or press the Esc key.
5. Click New Entity Reference , which is the last button in the left tool bar.
Stylus Studio displays a drop-down menu that lists the defined entities.
If the New Entity Reference button is not active, click Toggle Display of Entity References in the XML editor top tool bar. This button allows you to control whether you can refer to entities.
6. Double-click TCBCC.
Stylus Studio inserts the text
7. Click the Text tab at the bottom of the XML editor window.
Stylus Studio displays the
8. Click the Tree tab.