XFR (XML Formatting Rule) Reference

This chapter provides an overview of XFR (XML Formatting Rule), a discussion of its usage, and its elements and attributes.

1. Overview

Provides an overview of XFR(XML Formatting Rule, hereafter "XFR").

1.1. Features and Usage

XFR is used to describe a formatting rule in order to format saving XML documents. For each element used in the XML document, XFR specifies its alignment and the whitespace's handling within the element, the indentation, and formats the appearance when showing the source of the XML document.

1.2. Namespace URI Reference

The namespace URI reference for XFR is located at http://xmlns.xfytec.com/xfr. In the descriptions below, we use the namespace prefix xfr: for an element used in XFR.

2. Assigning XFR to XML Documents

By placing the vocabulary component created with a XVCD file in the folder for xfy technology user agent plug-in, you can automatically apply XFR to an XML document.

When xfy Developer's Toolkit is Installed

By placing the XVCD file describing XFR in the scripts folder under xfy technology user agent running environment, you can automatically apply it to an XML document.

Also, a specific XFR file can be applied to the XML document by describing the processing instruction within the XML document. To apply a particular XFR file to your XML document, you write the com.xfytec processing instruction with the xml-formatting-rule parameter in the XML document, as shown below:

<?com.xfytec xml-formatting-rule href="URL of XFR file" ?>

If multiple XFRs are applied in the com.xfytec xml-formatting-rule processing instruction, first described XFR takes precedence.

You don't need to install xfy Developer's Toolkit since xfy Basic Edition 1.0 already includes xfy Developer's Toolkit.

3. Elements and Attributes Defined in the Namespace for XFR

Provides a discussion of elements and attributes defined in XFR's namespace.

3.1. XML Formatting Rule

Elements and attributes defined in XFR namespace are listed below.

xfr:xfr Element

Involves describing the entire formatting rule by XFR. In the xfr:xfr element, you can describe the formatting rule of the element across multiple namespaces.

Attribute:

No attributes for the element.

Content:

As many xfr:rule elements as needed can be specified at the xfr:xfr element. xfr:rule element is optional. If omitted, formatting is not applied when saving an XML document.

xfr:rule Element

Describes the formatting rule of the specified element.

Attribute:
namespace-uri (mandatory)

Specifies the namespace that defines the element for which the formatting rule is applied. It can be URI string.

local-names (mandatory)

Specifies the local name within the namespace of the element to which the formatting rule is applied. Able to describe multiple element names, each separated by a whitespace.

Content:

The xfr:rule element can contain the following elements in any order.

xfr:tab Element

For the element formatting in block format, specify the indentation relative to the parent element's indentation using tab number. If xfr:tab element is omitted, 1 is applied to the relative indentation.

Attribute:

No attributes for the element.

Content:

For the xfr:tab element, describe the indentation relative to the parent element's indentation using tab number. If the content is omitted, 1 is applied to the relative indentation.

xfr:preserve-whitespaces Element

Specifies whether a whitespace character is saved as it is included in the text data in the element. The whitespace character is a string composed only of characters treated as a whitespace according to XML specification (#x20, #x9, #xD, #xA). If the element contains a child element and the formatting out of the xfr:preserve-whitespaces element is not applied to the child element, the value applied to text data in the child element is also applied.

Attribute:

No attributes for the element.

Content:

Specify, using a true/false value, whether a whitespace character is saved as it is included in the text data in the xfr:preserve-whitespaces element. If true is specified, whitespace characters included in the element are saved as it is. If false is specified, contiguous whitespace characters in XML are replaced by one single-byte whitespace character.

xfr:inline Element

Specifies whether formatting in inline format is applied to the element.

Attribute:

No attributes for the element.

Content:

In the xfr:inline element, describe using a true/false value whether formatting in inline format is applied to the element. If true is specified, formatting in inline format is applied. If false is specified, the parent element's setting is inherited.

xfr:content-output Element

Specifies whether to save the element or not.

Attribute:

No attributes for the element.

Content:

In the xfr:content-output element, specify whether to save the element or not using the following strings.

self
Saves the tags of the element to be processed, but does not save its child nodes such as elements or nodes.
none
Does not save the element to be processed, both tags and contents.
default
Saves the element to be processed, both tags and contents.

If any string other than the above is specified, default is assumed to be specified.