# XML Processing Environment Service Reference

This appendix is a reference of the XML Processing Environment (xpe) service.

## XML Processing Environment

Symbol | Description
--- | ---
afnix-xpe | module
afnix:xpe | nameset

XmlContent

The `XmlContent` class is an extension of the xml document class that operates at the uri level. If the uri is a local file the xml document is created from an input file stream. If the uri is an url, the content is fetched automatically. The class constructors permit to separate the content name from the document name and also to specify the content encoding.

xml-content-p
XmlDocument
Mime
XmlContent
String

The `XmlContent` constructor creates a xml document by name. The document name is the normalized uri name that always favor a file scheme in the absence of it.

XmlContent
String String

The `XmlContent` constructor creates a xml document by name. The first argument is the content name. The second argument is the document name which is normalized to form the uri name used to load the document.

XmlContent
String String String

The `XmlContent` constructor creates a xml document by name and encoding mode. The first argument is the content name. The second argument is the document name which is normalized to form the uri name used to load the document. The third argument is the content character encoding.

get-document-name
String
none

The `get-document-name` method returns the object document name. This method complements the `get-name` method which returns the object name.

XmlFeature

The `XmlFeature` class is a xml processor base class that defines a processing feature. A processing feature is defined by name and information with a processing level. The default processing level is null. When the processor is called, it calls sequentially and in ascending order all features.

xhtml-feature-p
Nameable
get-info
String
none

The `get-info` method returns the xml feature information string. The feature name is available from the `get-name` provided by the `Nameable` base class.

set-processing-level
none
Integer

The `set-processing-level` method sets the feature processing level. The integer argument is the level to set.

get-processing-level
Integer
none

The `get-processing-level` method returns the feature processing level.

processing-level-p
Boolean
Integer

The `processing-level-p` predicate returns true if the integer argument equal the feature processing level.

process
XmlContent
XmlContent

The `process` method process the input xml content and returns a new xml content. The method is automatically called by the xml processor.

XmlProcessor

The `XmlProcessor` class is a global class designed to operate on a xml content. The xml processor provides several features that can be enabled prior the document processor. Once the features are defined, the 'process' method can be called and a new xml content can be produced.

xml-processor-p
Object
XmlProcessor
none

The `XmlProcessor` constructor creates a default xml processor without any feature.

feature-length
Integer
none

The `feature-length` method returns the number of features defined in the xml processor.

add-feature
none
XmlFeature

The `add-feature` method adds a feature object to the processor. The feature processing level does not have to be sorted prior the insertion. Adding multiple feature creates a processor chain.

get-feature
XmlFeature
Integer

The `get-feature` method return a processor feature by index.

process
XmlFeature
XmlFeature

The `process` method create a new xml content by calling processing feature chain. The feature chain consists of feature object sorted in ascending order. If the processor contains only one feature, calling the `process` method is equivalent to call the `XmlFeature` same method.

XmlInclude

The `XmlInclude` class is a xml processor feature class designed to handle the "XInclude" schema that permits to include xml document. The feature operates recursively by scanning the document for a "xi:include" tag and replacing the content by the appropriate tree. The feature operates recursively unless specified otherwise.

xml-include-p
XmlFeature
XmlInclude
none

The `XmlInclude` constructor creates a default xml include feature. The default feature processing level is 10.

XmlInclude
Integer

The `XmlInclude` constructor creates a xml include feature with a processing level. The integer argument is the feature processing level to set.