Reusing Content with Templates and Libraries > Exporting and importing XML content > Using XML tag notations

 

Using XML tag notations

Dreamweaver lets you export XML content using either of two tag notations: editable region name tags or standard Dreamweaver XML tags. Choose the notation that best suits how XML content is incorporated into your Web site.

The easiest way to see the differences between the two tag notations, if you understand XML syntax, is to look at examples. The following XML code was exported from a document based on a template named newstemplate. The document contains one defined editable region, named News_Story (and a default editable region, doctitle, which contains the document's title tag).

Editable region name tags use the names of your document's editable regions as XML tags. The content from each editable region is included as a CDATA section. In this example, the doctitle tag identifies the title of the document, and the News_Story tag identifies the editable region.
<?xml version="1.0"?>
<newstemplate template="/Templates/newstemplate.dwt">
	<doctitle>
		<![CDATA[<title>Today's Headline Story</title>]]>
	</doctitle>
	<News_Story>
		<![CDATA[<p>This is where the story goes.</p>]]>
	</News_Story>
</newstemplate>
Standard Dreamweaver XML tags use a tag named item. The item tag has a name attribute that gives the name of the editable region; the tag contains a CDATA section that in turn contains the contents of the editable region. In this example, the item tag with name="doctitle" identifies the title of the document, and the item tag with name="News_Story" identifies the editable region.
<?xml version="1.0"?>
<templateItems template="/Templates/newstemplate.dwt">
	<item name="doctitle">
		<![CDATA[<title>Today's Headline Story</title>]]>
	</item>
	<item name="News_Story">
		<![CDATA[<p>This is where the story goes.</p>]]>
	</item>
</templateItems>