Content Assembler API 2.1.2

com.endeca.content.assembler
Class ContentAssembler

java.lang.Object
  extended by com.endeca.content.assembler.ContentAssembler

public class ContentAssembler
extends java.lang.Object

Used to transform a ContentResource into an object model representation of its content item.

Evaluation of a tag is accomplished by delegating to the evaluate method of the TagHandler which is registered for that tag. These handlers may simply transform the XML into objects, or they may execute additional queries or invoke the evaluate method of the ContentAssembler on child tags.

Since:
2.1.0
Version:
2.1.0
See Also:
ContentItem

Constructor Summary
ContentAssembler(boolean pValidating)
          Constructs a new ContentAssembler.
 
Method Summary
 ContentItem assemble(ContentContext pContentContext, ContentResource pContentResource)
          Assembles a ContentResource into a ContentItem.
 java.lang.Object evaluate(ContentContext pContentContext, org.w3c.dom.Element pElement)
          Finds the appropriate TagHandler, invokes its evaluate method, and returns the result.
 void setDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory pDocumentBuilderFactory)
          Overrides the default DocumentBuilderFactory used when parsing content.
 void setValidating(boolean pValidating)
          Specifies whether XML validation should be enabled when parsing content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentAssembler

public ContentAssembler(boolean pValidating)
                 throws InitializationException
Constructs a new ContentAssembler.

Parameters:
pValidating - Whether schema validation should be performed on the content XML. This feature is only available on Java 1.5 and newer.
Throws:
InitializationException - If an error occurred while creating the assembler.
Method Detail

assemble

public ContentItem assemble(ContentContext pContentContext,
                            ContentResource pContentResource)
                     throws ContentException
Assembles a ContentResource into a ContentItem.

Parameters:
pContentContext - The context within which the resource is being assembled
pContentResource - The resource to assemble
Returns:
The assembled content item.
Throws:
ContentException - If an error occurred during assembly.

evaluate

public java.lang.Object evaluate(ContentContext pContentContext,
                                 org.w3c.dom.Element pElement)
                          throws ContentException
Finds the appropriate TagHandler, invokes its evaluate method, and returns the result.

Parameters:
pContentContext - The context within which the element is being evaluated
pElement - The XML element to evaluate
Returns:
The result returned by the TagHandler.
Throws:
ContentException - If an error occurred during evaluation.
See Also:
TagHandler.evaluate(ContentContext, Element)

setValidating

public void setValidating(boolean pValidating)
                   throws InitializationException
Specifies whether XML validation should be enabled when parsing content.

Enabling XML validation requires XML schema compilation features that were made available in Java 1.5.

It is important to note that this method will replace any prior changes specified via the setDocumentBuilderFactory method with a default factory.

Parameters:
pValidating - Specifies whether XML validation should be enabled
Throws:
InitializationException - If an error occurred while enabling XML validation.

setDocumentBuilderFactory

public void setDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory pDocumentBuilderFactory)
                               throws InitializationException
Overrides the default DocumentBuilderFactory used when parsing content.

To work properly, factories specified via this method must be namespace aware.

Parameters:
pDocumentBuilderFactory - The DocumentBuilderFactory to use
Throws:
InitializationException - If an error occurred while setting the factory.

Content Assembler API 2.1.2

Copyright © 2012 Endeca Technologies, Inc. All Rights Reserved.
@VERSION
PRODUCT: Content Assembler API (ContentAssemblerAPIJava)
VERSION: 2.1.2
BUILD:   54DEV
ARCH_OS: n/a
DATE:    2012-02-16T20:28:44-0500