core Namespace

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

The base core commands for xchains. These commands provide flow control and value management in the current context.

Available Catalogs

catalog

The default implementation of Catalog for the XChains package.

Available Commands

chain

A general container for xchain commands. Children of a chain are executed, in order, until one of them returns true or throws an exception.

If one of the chain's children returns true , then each child that was executed will have its post process executed and then the chain will return true .

If one of the chain's children throws an exception, then each children that was executed, including the command that threw the exception, will have its post process executed with the exception that was thrown. If none of the children's post process returns true , then the exception will be rethrown by this chain. If any of the childrens post process returns true , then this chain will return false and its next sibling will execute.

<xchain:chain xmlns:xchain="http://www.xchain.org/core/1.0">
   ...
 </xchain:chain>

choose

The choose command allows the execution of one chain based on tested conditions. Only when and otherwise commands can be direct children of the choose command. Each when command has a test attribute. The first when command whose test attribute evaluates to true will be executed and no other child when or otherwise commands will be executed or have their test condition evaluated. otherwise commands will always be executed if encountered.

<xchain:choose xmlns:xchain="http://www.xchain.org/core/1.0">
   <xchain:when test="/some/xpath">
     ...
   </xchain:when>
   <xchain:when test="/some/other/xpath">
     ...
   </xchain:when>
   <xchain:otherwise>
     ...
   </xchain:otherwise>
 </xchain:choose>

otherwise

choose commands can include an otherwise command. This command will be executed if none of the when clauses associated with the same choose command executed.

when

Attributes
NameDescriptionTypeDefault ValueJava Return Type
test

The test for this when clause. If the test evaluates to true, then the when clause is executed. If the test evaluates to false, then the next when or otherwise command in the choose will be tested.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/ABoolean

choose commands can have one or more when commands nested in it. The first when command whose test evaluates to true will be executed.

debug-message

Attributes
NameDescriptionTypeDefault ValueJava Return Type
messageorg.xchain.annotations.AttributeType.ATTRIBUTE_VALUE_TEMPLATEEmpty MessageString
levelorg.xchain.annotations.AttributeType.ATTRIBUTE_VALUE_TEMPLATEdebugString
loggerorg.xchain.annotations.AttributeType.ATTRIBUTE_VALUE_TEMPLATEorg.xchain.namespaces.core.DebugMessageCommandString

eval

Attributes
NameDescriptionTypeDefault ValueJava Return Type
expressionThe xpath expression to be evaluated using context.getValue(context, Object.class);org.xchain.annotations.AttributeType.JXPATH_VALUEN/AObject

The eval command will evaluate an xpath expression.

<xchain:eval xmlns:xchain="http://www.xchain.org/core/1.0" expression="/some/xpath"/>

execute

Attributes
NameDescriptionTypeDefault ValueJava Return Type
system-idThe system id of the catalog to search for the command. If no system id is provided, then the current catalog is searched. If the system id is relative, then it is resolved against the current catalog's system id.org.xchain.annotations.AttributeType.JXPATH_VALUEN/AString
nameThe qname of the command to execute. The qname is required.org.xchain.annotations.AttributeType.JXPATH_VALUEN/AQName

The execute command can execute another command chain. The command can be in the current catalog or in a different catalog. The command chain will continue if and only if the referenced command would continue the command chain.

<xchain:chain xmlns:xchain="http://www.xchain.org/core/1.0">
   ...
   <xchain:execute system-id="$myCatalog" name="$myCommand">
   ...
 </xchain:choose>

filter-chain

A general container for xchain commands. Children of a chain are executed, in order, until one of them returns true or throws an exception.

If one of the chain's children returns true , then each child that was executed will have its post process executed and then the chain will return true .

If one of the chain's children throws an exception, then each children that was executed, including the command that threw the exception, will have its post process executed with the exception that was thrown. If none of the children's post process returns true , then the exception will be rethrown by this chain. If any of the children's post process returns true , then this chain will return false and its next sibling will execute.

If post process is run on this chain then the post process will be run on it's children in reverse order of their original execution.

<xchain:filter-chain xmlns:xchain="http://www.xchain.org/core/1.0">
   ...
 </xchain:filter-chain>

filter-choose

The choose command implemented as a filter. This command allows the execution of one chain based on tested conditions. Only when and otherwise commands can be direct children of the choose command. Each when command has a test attribute. The first when command whose test attribute evaluates to true will be executed and no other child when or otherwise commands will be executed or have their test condition evaluated. otherwise commands will always be executed if encountered.

<xchain:filter-choose xmlns:xchain="http://www.xchain.org/core/1.0">
   <xchain:when test="/some/xpath">
     ...
   </xchain:when>
   <xchain:when test="/some/other/xpath">
     ...
   </xchain:when>
   <xchain:otherwise>
     ...
   </xchain:otherwise>
 </xchain:filter-choose>

otherwise

filter-choose commands can include an otherwise command. This command will be executed if none of the when clauses associated with the same filter-choose command executed.

when

Attributes
NameDescriptionTypeDefault ValueJava Return Type
test

The test for this when clause. If the test evaluates to true, then the when clause is executed. If the test evaluates to false, then the next when or otherwise command in the filter-choose will be tested.

org.xchain.annotations.AttributeType.JXPATH_VALUEN/ABoolean

filter-choose commands can have one or more when commands nested in it. The first when command whose test evaluates to true will be executed.

filter-if

Attributes
NameDescriptionTypeDefault ValueJava Return Type
testThe test for the if command. This should evaluate to a boolean.org.xchain.annotations.AttributeType.JXPATH_VALUEN/ABoolean

The if command implemented as a filter. This command will execute its child commands if the test attribute evaluates to true .

<xchain:filter-if xmlns:xchain="http://www.xchain.org/core/1.0" test="/some/xpath">
   ...
 </xchain:filter-if>

filter-variable

Attributes
NameDescriptionTypeDefault ValueJava Return Type
nameThe QName of the variable.org.xchain.annotations.AttributeType.QNAMEN/AQName
selectThe value of the variable.org.xchain.annotations.AttributeType.JXPATH_VALUEN/AObject
select-nodesThe value of the variable.org.xchain.annotations.AttributeType.JXPATH_SELECT_NODESN/AList
select-single-nodeThe value of the variable.org.xchain.annotations.AttributeType.JXPATH_SELECT_SINGLE_NODEN/AObject
scopeThe scope of the variable. Can either be the literal request, exeuction or chain.org.xchain.annotations.AttributeType.LITERALrequestScope

The variable command implemented as a filter. The filter-variable will declare and set a variable in the context. The name attribute is the QName of the variable. The select , select-nodes , or select-single-node attribute will be the value of the variable. The scope attribute will determine the scope of the variable. A 'chain' scope variable will only exist in the current context. A 'request' scope variable will exist for every context. A request scope is assumed if no scope attribute is provided.

During post process the original value at the QName will be restored. If no value existed at the QName then the variable will be undeclared.

for-each

Attributes
NameDescriptionTypeDefault ValueJava Return Type
selectAn XPath to a list.org.xchain.annotations.AttributeType.JXPATH_ITERATE_POINTERSN/AIterator
The for-each will execute its child commands for each element selected by the select attribute.
<xchain:for-each xmlns:xchain="http://www.xchain.org/core/1.0" select="/some/xpath">
   ...
 </xchain:for-each>
<xchain:for-each xmlns:xchain="http://www.xchain.org/core/1.0" select-nodes="/some/xpath">
   ...
 </xchain:for-each>

handled

Attributes
NameDescriptionTypeDefault ValueJava Return Type
testorg.xchain.annotations.AttributeType.JXPATH_VALUEN/ABoolean

A command that can stop the execution of an xchain by reporting that it handled the request. The command will return true when its test condition is true.

  <xchain:chain xmlns:xchain="http://www.xchain.org/core/1.0">
     <xchain:handled test="true()"/>
     <-- A command here will never execute -->
   </xchain:chain>

if

Attributes
NameDescriptionTypeDefault ValueJava Return Type
testThe test for the if command. This should evaluate to a boolean.org.xchain.annotations.AttributeType.JXPATH_VALUEN/ABoolean
The if command will execute its child commands if the test attribute evaluates to true .
<xchain:if xmlns:xchain="http://www.xchain.org/core/1.0" test="/some/xpath">
   ...
 </xchain:if>

iterate

Attributes
NameDescriptionTypeDefault ValueJava Return Type
variableThe QName of the variable.org.xchain.annotations.AttributeType.QNAMEN/AQName
iteratorThe JXPath of the java.util.Iterator object. This method is provided for backwards compatiblity, the select attribute should be used instead.org.xchain.annotations.AttributeType.JXPATH_VALUEN/AIterator
selectThe JXPath of the object to iterate. The object can be of type java.util.Iterator, java.util.Enumeration, java.util.Collection, java.util.Map, or an array.org.xchain.annotations.AttributeType.JXPATH_VALUEN/AObject
scopeThe scope of the variable. Can either be the literal global or local.org.xchain.annotations.AttributeType.LITERALrequestScope
The iterate command will execute its child commands for each element in the object selected by the select attribute.
<xchain:iterate xmlns:xchain="http://www.xchain.org/core/1.0" select="/some/xpath" variable="name">
   ...
 </xchain:iterate>

throw

Attributes
NameDescriptionTypeDefault ValueJava Return Type
selectorg.xchain.annotations.AttributeType.JXPATH_VALUEN/AException

trace

Attributes
NameDescriptionTypeDefault ValueJava Return Type
messageorg.xchain.annotations.AttributeType.ATTRIBUTE_VALUE_TEMPLATEBeginning XChain Stack traceString
levelorg.xchain.annotations.AttributeType.ATTRIBUTE_VALUE_TEMPLATEdebugString
loggerorg.xchain.annotations.AttributeType.ATTRIBUTE_VALUE_TEMPLATEorg.xchain.namespaces.core.TraceCommandString

variable

Attributes
NameDescriptionTypeDefault ValueJava Return Type
nameThe QName of the variable.org.xchain.annotations.AttributeType.QNAMEN/AQName
selectThe value of the variable.org.xchain.annotations.AttributeType.JXPATH_VALUEN/AObject
select-nodesThe value of the variable.org.xchain.annotations.AttributeType.JXPATH_SELECT_NODESN/AList
select-single-nodeThe value of the variable.org.xchain.annotations.AttributeType.JXPATH_SELECT_SINGLE_NODEN/AObject
scopeThe scope of the variable. Can either be the literal request, execution or chain.org.xchain.annotations.AttributeType.LITERALrequestScope

The variable command will declare and set a variable in the context. The name attribute is the QName of the variable. The select , select-nodes , or select-single-node attribute will be the value of the variable. The scope attribute will determine the scope of the variable. A 'chain' scope variable will only exist if the current context. A 'request' scope variable will exist for every context. A request scope is assumed if no scope attribute is provided.

<xchain:variable xmlns:xchain="http://www.xchain.org/core/1.0" name="/some/xpath" select="/some/xpath"/ scope="chain"/>

with

Attributes
NameDescriptionTypeDefault ValueJava Return Type
selectThe XPath use as the root context.org.xchain.annotations.AttributeType.JXPATH_POINTERN/APointer

The with command will execute its child commands with the selected element as the root context.

<xchain:with xmlns:xchain="http://www.xchain.org/core/1.0" select="/some/xpath">
   ...
 </xchain:with>