*
XML Configured ProcessorXML Configured Processor
The XMLConfiguredProcessor class allows a Processor instance to be configured via a XML file.

The XML file should define the tags and tag handlers that hoglet should use to process a string of text. It should also contain what delimiters that hoglet should in processing the text.

See an example: tag-handlers.xml file.

The file passed to the processor should have a root element of: tagHandlers.
 
Usage
To use the processor just do:
1:  XMLConfiguredProcessor xcp = new XMLConfiguredProcessor (
2:     new File ("/path/to/tag-handlers.xml"));
3:  
4:  // Process a file.
5:  String content = xcp.process (new File ("/path/to/myfile.txt"));
Alternatively you could use the: FileProcessor to process a file.
*
Defining Tag Handlers
Each tag handler is defined by using a handler element, which should be a child of: tagHandlers.
 
Element definition
The table below defines the elements that can be used in defining a tag handler to be used by hoglet in the XML file. Note: attributes are marked with either a R - meaning the attribute is required and must have a non-blank value or O - meaning the attribute is optional.

ElementAttributesRequiredChild ElementsParent ElementsDescription
handlerclass (string, R),
tag (string, R)
YesinittagHandlersDefines a tag handler that hoglet should use in processing a string of text. The class attribute should be a fully-qualified class name of a class that implements the TagHandler interface.

The tag attribute should be a string that defines the tag to be used.

The child element init will be passed to the handler instance, but only if the class implements the JDOMInitable interface. The class must also have a no-args constructor.
initVariable upon the handlerNoVariable upon the handlerhandlerThis element will be passed to the handler instance if it implements the JDOMInitable interface. The content of this element and whether it has any attributes is entirely dependent upon the handler.
 
Example
<handler class="org.hoglet.handlers.core.TextHandler"
         tag="i">
  <init>
    <templates>
      <wrapper><[CDATA[<li>[[VALUE]]</li>]]></wrapper>
    </templates>
  </init>
</handler>
*
Specifying Delimiters
The delimiters that hoglet should use are also defined in the XML file. Each delimiter is specified by using an attribute on the tagHandlers element.

All the attributes are required and must have a non-blank value. Only the first character of the attribute is used as the delimiter.

The attributes are:
NameDescription
openTagIs the delimiter for the opening of a tag, i.e. [.
closeTagIs the delimiter for the closing of a tag, i.e. ].
shortClosePrefixIs the delimiter for closing an opening tag that doesn't have an end tag, it can also be used to prefix an end tag, i.e. /.
escapeIs the delimiter for escaping other delimiters, i.e. .
tagOptionsSeparatorIs the delimiter for separating a tag name from it's options, i.e. whitespace.
optionsSeparatorIs the delimiter for separating options, i.e. ,.
optionNameSeparatorIs the delimiter for separating option names and values, i.e. =.
 
Example
<tagHandlers openTag="["
             closeTag="]"
             shortClosePrefix="/"
             escape=""
             tagOptionsSeparator=" "
             optionsSeparator=","
             optionNameSeparator="=">

</tagHandlers>
*
The _default handler
The default handler is specified by using a tag name _default for a handler definition.
 
Example
<handler class="myhandlers.DefaultHandler"
         tag="_default" />
*