sax Namespace

Namespace URI: http://www.xchain.org/sax/1.0

The xchain sax command package.

Available Commands

command-source

The <sax:command-source/> command is used in a sax pipeline to get source nodes from a command. When using this element, it is important to understand when it's children will not be executed until the surrounding pipeline element has finished building the pipeline.

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   <sax:command-source> 
     ...
   </sax:command-source>
   ...
   <sax:result>
 </sax:pipeline>

multi-document-result

The <sax:multi-document-result/> result adds a MultiDocumentResult element to the sax pipeline.

null-result

The <sax:null-result> element creates a sax result that does nothing with the sax events it receives from the pipeline.

a source, then be followed by zero or more transformations, followed by a result.

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   ...
   <sax:null-result/>
 </sax:pipeline>

output-property

Attributes
NameDescriptionTypeDefault ValueJava Return Type
name

The name of the output property to set.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString
value

The value of the output property to set.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString

<sax:output-property/> elements are placed inside <sax:transfromer/> elements to set output properties on a transformer.

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   <sax:source .../>
   ...
   <sax:transformer system-id="'relative-uri-of-template'">
     <sax:output-property name="'name'" value="'value'"/>
   </sax:transformer>
   ...
   <sax:result .../>
 </sax:pipeline>

parameter

Attributes
NameDescriptionTypeDefault ValueJava Return Type
name

The name of the parameter to set.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString
value

The value of the parameter to set.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString

<sax:parameter/> elements are placed inside <sax:transfromer/> elements to set parameters on a transformer.

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   <sax:source .../>
   ...
   <sax:transformer system-id="'relative-uri-of-template'">
     <sax:parameter name="'name'" value="'value'"/>
   </sax:transformer>
   ...
   <sax:result .../>
 </sax:pipeline>

pipeline

Attributes
NameDescriptionTypeDefault ValueJava Return Type
uri-resolver

The uri resolver to use when building this pipeline.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AURIResolver

The <sax:pipeline> command creates a sax pipeline, and then executes it. A pipeline should start with a source, then be followed by zero or more transformations, followed by a result.

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   ...
 </sax:pipeline>

result

Attributes
NameDescriptionTypeDefault ValueJava Return Type
systemId

DEPRICATED: Use system-id instead. The system id to send the output to.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString
system-id

The system id to send output to.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString
path

The file path to send output to.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString
select

The object to send output to.

org.xchain.annotations.AttributeType.JXPATH_SELECT_SINGLE_NODEN/AObject

The <sax:result/> command adds result objects to a pipeline. This command can add several types of results, based on the attributes defined on the command. To write output to a system id, add the system-id attribute to the command:

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   ...
   <sax:result system-id="'file:/some/path'">
 </sax:pipeline>

To write output to a file path, add the path attribute:

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   ...
   <sax:result path="'/some/path'">
 </sax:pipeline>

To write output to an object in the context, add the select attribute:

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   ...
   <sax:result select="$result">
 </sax:pipeline>

The value of the select attribute must resovle to one of:

  • javax.xml.transform.Result
  • org.xml.sax.ContentHandler
  • org.w3c.dom.Node
  • java.io.OutputStream
  • java.io.Writer
  • java.io.File

serializer

Attributes
NameDescriptionTypeDefault ValueJava Return Type
methodorg.xchain.annotations.AttributeType.JXPATH_VALUE\xml\String
indentorg.xchain.annotations.AttributeType.JXPATH_VALUEN/ABoolean

The <sax:serializer/> element adds a serialization stage to the pipeline.

transformer

Attributes
NameDescriptionTypeDefault ValueJava Return Type
system-id

The system id of the stylesheet.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString

The <sax:transformer/> adds a transform to a sax pipeline. Currently, XChains supports both XSLT and STX transformations. To add a transform to a pipeline, include a <sax:transformer/> element between the source and result of a <sax:pipeline/> element.

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   <sax:source .../>
   ...
   <sax:transformer system-id="'relative-uri-of-template'"/>
   ...
   <sax:result .../>
 </sax:pipeline>

Parameters can be passed to a template by including <sax:parameter/> elements inside the <sax:transformer/> element.

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   <sax:source .../>
   ...
   <sax:transformer system-id="'relative-uri-of-template'">
     <sax:parameter name="'name'" value="'value'"/>
   </sax:transformer>
   ...
   <sax:result .../>
 </sax:pipeline>

Since the transformer element is a command, you can optionally include a template by adding a conditional element around it. For example, you can add a template based on some test using the $lt;xchain:if/> element.

<sax:pipeline xmlns:sax="http://www.xchain.org/sax/1.0">
   <sax:source .../>
   ...
   <xchain:if test="$test"/>
     <sax:transformer system-id="'relative-uri-of-template'"/>
   &lt:/xcahin:if>
   ...
   <sax:result .../>
 </sax:pipeline>

url-source

Attributes
NameDescriptionTypeDefault ValueJava Return Type
system-idorg.xchain.annotations.AttributeType.JXPATH_VALUEN/AString