Reusing Content with Templates and Libraries > Exporting and importing XML content |
Exporting and importing XML content
You can think of a document based on a template as containing a set of data represented by name/value pairs. Each pair consists of the name of an editable region, and the contents of that region. For example, suppose your template contains three editable regions: item_number, item_price, and item_color. You could fully describe a document based on that template by providing the name of the template and three name/value pairs, one for each editable region.
Dreamweaver lets you export those name/value pairs into an XML file so that you can work with the data from the document outside of Dreamweaver (in an XML editor, for example, or a text editor, or even a database application). Conversely, if you have an XML document that's structured appropriately, you can import the data from it into a document based on a Dreamweaver template. For more information, see About XML.
To export a document's editable regions as XML:
1 | Choose File > Open, and open a document that's based on a template (and contains editable regions). |
2 | Choose File > Export > Export Editable Regions as XML. |
3 | In the XML dialog box, choose a tag notation and click OK. |
See Using XML tag notations for details. | |
4 | In the dialog box that appears, enter a name for the XML file and click Save. |
Dreamweaver generates an XML file containing the material from the document's editable regions. The XML file includes the name of the template the document is based on, as well as the name and contents of each editable region. | |
Note: Material in the locked regions is not exported to the XML file. | |
To import XML content:
1 | Choose File > Import > Import XML into Template. |
2 | Select the XML file and click Open. |
Dreamweaver creates a new document based on the template specified in the XML file. It then fills in the contents of each editable region in that document using the data in the XML file. The resulting document appears in a new Document window. If the specified template is not found, Dreamweaver prompts you to select a template to use.
Note that if your XML file isn't set up exactly the way Dreamweaver expects, you may not be able to import your data. One solution to this problem is to export a dummy XML file from Dreamweaver, so that you'll have an XML file with exactly the right structure. Then copy the data from your original XML file into the exported XML file. The result is an XML file with the correct structure that contains the appropriate data, all ready to be imported.