XML with schema

FrameMaker allows you to import XML markup documents that are associated with W3C's XML Schema language. FrameMaker automatically creates a DTD and EDD from the schema. FrameMaker validates the document structure against the associated schema upon both import and export to XML, but does not retain all schema information upon export.

For complete details of how schema is mapped to DTD, see the Structure Application Developer’s Guide.

note:   This release offers support for schema that is equivalent to what was previously available for DTD. That is, EDD has not been extended to accommodate features in schema that are not available in DTD. For this reason, schemas are read-only, and you cannot export the EDD back out to schema.

Schema workflow

You can import an XML document that references a schema file, and you can specify a schema file in your structure application, to use for validating a document upon export to XML.

1)For a specific XML document, you can include the path of the schema file in the XML using attributes - noNamespaceSchemaLocation or schemaLocation depending on whether your schema includes a target namespace or not.

2)To specify a schema file for use in exporting XML, modify the structapps.fm file. Use the Schema element as part of the XMLApplication to provide the schema file path for export.

3)Open the XML in FrameMaker using a structured application. Edit it.

4)Save the XML using a structured application. The Schema element in the structapps.fm file is output in the file and validation is performed against it.

In this workflow, a DTD is generated automatically as an intermediary file from the schema given in the XML document, and you do not modify it. However, you can also use a schema file to generate an EDD; see Generate an element catalog (EDD) from a schema.

Changes to the structure application for schema support

The new element Schema, a child of the XmlApplication element, specifies the path of a schema file in the structapps.fm structure application file. If instance documents use name­spaces, the property Namespace in XmlApplication must be set to true.

In order for a structure application to be selectable in the Use Structured Application list while importing a document that is associated with a schema, the schema’s root element must be included in the application’s DOCTYPE in the XmlApplication element.

Generate an element catalog (EDD) from a schema

You can create an EDD from a schema definition, or import the elements from a schema definition into an existing EDD. FrameMaker converts the schema definition to DTD first, and then creates or imports elements to an EDD.

Use the following commands in the StructureTools menu:

Open schema: This command converts a specified schema to DTD, and creates an EDD from the DTD.

Import schema: This command converts a specified schema to DTD, and imports elements from the DTD into an existing EDD.

Each command opens a File Choose dialog box that allows you to specify the schema file, then a Save dialog box in which you specify where to save the resulting DTD file.

1)In Structured FrameMaker, select StructureTools > Open Schema.

2)Choose a schema file.

3)Choose a path for the DTD to be output.

4)Examine the resulting DTD and make any modification you want.

5)Create an EDD from the generated DTD, as described in the Structure Application Developer’s Guide.

6)Use this EDD to create a template that can be included in the Structured Application.

7)Provide your DTD path along with the Schema Location in the input XML. This will make sure that FrameMaker works correctly with your template. Validation of input and output XML is still performed against the schema.

View or edit XML namespaces

An XML namespace is a collection of names for specific element types and attribute names within an XML document. The scope of a namespace extends beyond its containing document.

Because a single XML document can contain elements and attributes that can be used by multiple software applications, you can use namespaces to differentiate which elements and attributes are to be used by which applications. Software applications that process XML use namespaces to recognize which tags and attributes they are designed to process.

Names from XML namespaces may appear as qualified names, which contain a single colon, sepa­rating the name into a namespace prefix and a local part. The prefix, which is mapped to a Uniform Resource Identifier (URI) reference, selects a namespace. The combination of the universally managed URI namespace and the document's own namespace produces identifiers that are univer­sally unique.

Using XML namespaces in FrameMaker

FrameMaker supports namespace usage for all elements in an XML document. When you import an XML document containing namespaces, all namespace information is preserved.

You can view, edit, add, or delete namespaces to an XML document in Structured FrameMaker using the Namespaces command. You can also use this command to view the definition of the prefix on an element tag and select the element that defines the prefix.

By default, namespaces in FrameMaker are handled as namespaces, appearing in the Namespaces dialog box. However, you can disable namespaces in the application and have them handled as attri­butes instead, appearing in the Structure View.

1)Open the document in Structured FrameMaker.

2)Select an element in the Structure View.

note:   Elements that contain namespaces appear in Structure View with an asterisk (*) next to their names.

3)Choose Element > Namespaces.

4)In the Namespaces dialog box, click Select Defining Element to view the namespace for the selected element in the Structure View.

5)Make any desired changes to the Declared Namespaces, Prefix, or Path and then click Add, Change, or Delete. To close without saving your changes, close the dialog box without clicking an option.

September 30, 2016

Legal Notices | Online Privacy Policy