Create XML documents

Learn how to create a new XML document, open an XML document, and save an XML Document with Adobe FrameMaker.

In this topic

Introduction

With Adobe FrameMaker, you can create a blank XML document. You can also create an XML document that is based on an existing DTD (Document Type Definition) or on an existing Structured Application. You can also open existing XML documents, edit them, and save them.

Create a blank XML

You can create a blank XML document from scratch. This document only contains a single root element (<ROOT>).

  1. Open the New XML dialog (File > New > XML).

  2. In the Other XML tab, select Empty XML and click OK.

  3. Open the Elements catalog to view the list of elements in the catalog (View > Panels > Element Catalog).

    Note: The Elements catalog contains a <TEXT> and a <ROOT> element.

In the WYSIWYG view, you can only add <ROOT> elements or text to the root elements.

In the XML view, you are able to add elements to the XML structure. For example, you can add a <SECTION> and a <P> element within a <ROOT> element:

Figure 1. p element added in XML view
Adding a p element in the XML view

In the WYSIWYG view, the Elements catalog now displays the <SECTION> and the <P> element. You can now add this element in the XML document. This document is not based on any Structured Application, so FrameMaker does not enforce any structural rules on the document. FrameMaker, however, ensures that the structure of the XML is maintained.

Create an XML based on a DTD

You can create a XML document based on an existing DTD (Document Type Definition).

  1. Save the following snippet into a text file.

    <!ELEMENT BOOK (CHAPTER+)> 
    <!ELEMENT CHAPTER (HEADLINE,BODY)> 
    <!ELEMENT HEADLINE (#PCDATA)>
    <!ELEMENT BODY (#PCDATA)> 
    <!ATTLIST CHAPTER AUTHOR CDATA #REQUIRED> 
  2. Save the text file with the .dtd extension.

  3. Open the New XML dialog (File > New > XML).

  4. In the Other XML tab, select DTD based XML and click OK.

  5. In the New XML dialog:

    Root Element

    Specify the name for the root element of the XML document. This is the topmost element in the hierarchy.

    Public ID

    A public ID in an XML document makes it portable to other computers.

    System ID

    Path to the DTD. This can be a path on your file system or a URL.

    Note: If you view the document in the XML view, the public ID and the System ID are stored in the DOCTTYPE declaration at the top of the file.
  6. Click OK.

    The <BODY>, <CHAPTER>, and <HEADLINE> elements defined in the DTD are available in the Elements catalog.

  7. Insert the <CHAPTER> element into the document.

    The Attributes for New Element dialog prompts you to specify the value of the AUTHOR attribute.

Create an XML based on a Structured Application

A Structured Application defines structural rules (using EDD or DTD), content formatting (using templates), read/write rules for the documents that are based on the application. FrameMaker provides a set of out-of-the-box Structured Applications that you can use to create documents. These applications are based on the following open standards:

DITA

Darwin Information Typing Architecture (DITA) provides an off-the-shelf DTD and set of rules designed specifically for writing online documentation, such as software help files. It defines an element structure suited to authoring, producing, and delivering technical documentation. The types of elements in DITA include, for example, <topic>, <title>, <shortdesc>, <prolog>, <body>, and <concept>.

xDocBook

DocBook is also an open standard, designed for technical articles and documentation. DocBook provides a DTD for writing technical books and articles, with a structure that such forms imply. DocBook elements include <article>, <section>, <title>, <articleinfo>, and <pubdate>.

XHTML

Extensible Hypertext Markup Language (XHTML) is an extension of HTML that is based on XML and is designed to work with XML-based applications. It can be viewed, edited, and validated with standard XML tools.

S1000D

For performance considerations, FrameMaker does not run the associated S1000D scripts at startup. Before creating document based on S1000D applications, you need to:

  1. Choose Edit > Preferences to open the Preferences dialog.

  2. Go to the General > Launch tab and remove the following entries from the Don’t Load Startup Scripts field:

    S1000dUtilities and S1000Dmenu

  3. Click OK and restart FrameMaker.

Note: For more information about S1000D, see Adobe FrameMaker (2017 release) Application Pack for S1000D.

Quick access to the S1000D/ATA resources has been provided in the Help > S1000D Functionality menu.

The new menu items under S1000D Functionality are:

To know more, choose Help > S1000D Functionality.

In addition, you can create your own Structured Application. You can then create documents based on this application.

  1. Choose File > New > XML to open the New XML dialog.

  2. Select a Structured Application from the Structured Applications tab or select a DITA Structured Application in the DITA tab.

    Note: The DITA Structured Applications are also available in the Structured Applications tab.
  3. Click OK.

The elements in the Elements catalog and the attributes defined for each element are based on the Structured Application on which the document is based.

Since structured documents enforce structural rules, the elements in the Elements catalog are based on the current context.

Save an XML document

When you save an XML document, if you prompted with the following dialog, you need to select the associated Structured Application.

Figure 2. Choose Structured Application
Selecting theassociatedStructuredApplicationwhile saving an XML document

If you choose an incompatible Structured Application, the errors are logged to the message console.

When you open a structured document, the FrameMaker error console displays structural and other issues in a document, if any. This console also provides the following information about document issues:

Open an XML document

When you open an XML document, if you are prompted with the following dialog, you need to select the associated Structured Application.

Figure 3. Choose Structured Application
Selecting theassociatedStructuredApplicationwhile opening an XML document

If you choose an incompatible Structured Application, the errors are logged to the error console. In addition, if the XML document hierarchy does not follow the structural rules defined in application, the document is displayed with errors in the Structure View.