org.specrunner.source.core
Class SourceFactoryHtml

java.lang.Object
  extended by org.specrunner.source.core.EncodedImpl
      extended by org.specrunner.source.core.AbstractSourceFactory
          extended by org.specrunner.source.core.SourceFactoryHtml
All Implemented Interfaces:
Serializable, IEncoded, ISourceFactory, IResetable

public class SourceFactoryHtml
extends AbstractSourceFactory

The default implementation. Uses a NekoHTML parser under XOM to read the specification. The use of NekoHTML allows using less rigid XML/HTML documents which are fixed by NekoHTML on reading time.

The settings of NekoHTML makes the XML attributes name be in lower case. This poses a restriction on attribute names of plugins, instead of defining in a IPlugin implementation PluginX an attribute named loadOnStart, use loadonstart in small caps.

Author:
Thiago Santos
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.specrunner.source.core.AbstractSourceFactory
cache, namespace
 
Fields inherited from interface org.specrunner.source.IEncoded
DEFAULT_ENCODING, FEATURE_ENCODING
 
Constructor Summary
SourceFactoryHtml()
           
 
Method Summary
protected  nu.xom.Document fromTarget(URI uri, String target, String encoding)
          Load file from source.
protected  nu.xom.Document load(Reader reader)
          Load a source from either an InputStream or a Reader.
 
Methods inherited from class org.specrunner.source.core.AbstractSourceFactory
addDoctype, cleanTarget, initialize, isFile, newSource
 
Methods inherited from class org.specrunner.source.core.EncodedImpl
getEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.specrunner.source.IEncoded
getEncoding
 

Constructor Detail

SourceFactoryHtml

public SourceFactoryHtml()
Method Detail

fromTarget

protected nu.xom.Document fromTarget(URI uri,
                                     String target,
                                     String encoding)
                              throws SourceException
Description copied from class: AbstractSourceFactory
Load file from source.

Specified by:
fromTarget in class AbstractSourceFactory
Parameters:
uri - The source URI.
target - The source name.
encoding - The encoding.
Returns:
The document.
Throws:
SourceException - On load errors.

load

protected nu.xom.Document load(Reader reader)
                        throws SourceException
Load a source from either an InputStream or a Reader.

Parameters:
reader - InputStream.
Returns:
The source.
Throws:
SourceException - On load error.


Copyright © 2014. All rights reserved.