[Previous] [Contents] [Next]

Reusing Elements

In our sample template, you created elements that could be used to build a Web document. When it came time to add a new row, you copied the row structure and pasted a new row into the document. This new row had the entire structure already built into it. The same technique was used to duplicate several other elements, including the li element, the font element, the p element, and the a element.

Reusing elements that contain attributes and child elements guarantees that the entire document will be uniform. When you are building documents, this uniformity will help ensure that you are following the rules for the document. Reusable elements will also make it easier to build the entire document since you are building the document from predefined pieces. For example, it would be easy to include the additional h elements by reusing the p element. You would only need to insert the h2, h3, and h4 elements and copy and paste three p elements. In this example, you are reusing the p element. Figure 3-13 illustrates this.

Figure 3-13. XML Notepad, showing added h2, h3, and h4 elements.


[Previous] [Contents] [Next]