de.vc.jfo.rtf

## Class XMLDirectivesRecognizer

- java.lang.Object
- - de.vc.jfo.rtf.XMLDirectivesRecognizer

- All Implemented Interfaces:
    FieldListener
  Direct Known Subclasses:
    StylesheetWizard

      public class XMLDirectivesRecognizer
      extends java.lang.Object
      implements FieldListener

  The XMLDirectivesRecognizer is a field listener that recognizes XML directives that are placed directly in a RTF introduced by a FILLIN field. For following XML-directives you can additional set a wrap parameter to wrap a XSL-FO node by one of the following XML node:
  - xsl:for-each
  - xsl:if
  The wrap parameter must immediately follow the XML-directive and can have these values:
  - paragraph to wrap a fo:block (the paragraph).
  - table to wrap a fo:table.
  - table-row to wrap a fo:table-row inside a table.
  - list-item to wrap a fo:list-item of a fo:list-block.
  - list-block to wrap a fo:list-block.
  Furthmore it's possible to add other namespaces to the result document. To add a new namespace use the following pattern:
  {FILLIN "namespace prefix=uri"} where prefix is the namespace-prefix and uri is the full namespace URI.
  Examples:
  - {FILLIN "<xsl:value-of select=\"xPathExpression\"/>"}
  - {FILLIN "<xsl:for-each select=\"xPathExpression\" wrap=table-row/>"}
  - {FILLIN "<myNs:myNode/><myNs:mySecondNode/>"}
  - {FILLIN "namespace myNs=http://mycompany/ns"}

- - ### Field Summary

    - ### Fields inherited from interface de.vc.jfo.rtf.FieldListener

      `FIELD_FILLIN, FIELD_MERGEFIELD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLDirectivesRecognizer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addNamespace(FieldContext ctx, java.lang.String prefix, java.lang.String namespace)`
    `void` | `fieldEncountered(FieldContext context)` Invoked when a field is encountered by the RTF parser.
    `protected void` | `insertPlainNodeElement(FieldContext ctx, PlainXMLNodeElement node)`
    `boolean` | `isVerifyXMLSyntax()` Returns true if syntax check for XML directives is enabled.
    `void` | `setVerifyXMLSyntax(boolean verifyXMLSyntax)` Enables or disables the syntax check for XML directives.
    `protected void` | `wrapNode(FieldContext ctx, Node wrapper, java.lang.Class wrappedNodeClass)`
    `protected void` | `wrapRTFFile(FieldContext ctx, java.lang.String rtfFile, java.lang.String xmlSnippet)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMLDirectivesRecognizer

          public XMLDirectivesRecognizer()

  - ### Method Detail

    - #### setVerifyXMLSyntax

          public void setVerifyXMLSyntax(boolean verifyXMLSyntax)

      Enables or disables the syntax check for XML directives. Syntax verification is enabled by default, but can be disabled to improve the performance.
      Parameters:
        `verifyXMLSyntax` - true enables verification.

    - #### isVerifyXMLSyntax

          public boolean isVerifyXMLSyntax()

      Returns true if syntax check for XML directives is enabled.
      Returns:
        `true` if syntax check enabled.

    - #### fieldEncountered

          public void fieldEncountered(FieldContext context)

      Invoked when a field is encountered by the RTF parser.
      Specified by:
        `fieldEncountered` in interface `FieldListener`
      Parameters:
        `context` - FieldContext

    - #### insertPlainNodeElement

          protected void insertPlainNodeElement(FieldContext ctx,
                                    PlainXMLNodeElement node)

    - #### wrapNode

          protected void wrapNode(FieldContext ctx,
                      Node wrapper,
                      java.lang.Class wrappedNodeClass)

    - #### addNamespace

          protected void addNamespace(FieldContext ctx,
                          java.lang.String prefix,
                          java.lang.String namespace)

    - #### wrapRTFFile

          protected void wrapRTFFile(FieldContext ctx,
                         java.lang.String rtfFile,
                         java.lang.String xmlSnippet)

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.