org.apache.shindig.gadgets.parse.nekohtml
Class NekoSimplifiedHtmlParser

java.lang.Object
  extended by org.apache.shindig.gadgets.parse.GadgetHtmlParser
      extended by org.apache.shindig.gadgets.parse.nekohtml.NekoSimplifiedHtmlParser

public class NekoSimplifiedHtmlParser
extends GadgetHtmlParser

Supports parsing of social markup blocks inside gadget content. <script> elements with types of either "text/os-template" or "text/os-data" are parsed inline into contained DOM hierarchies for subsequent processing by the pipeline and template rewriters.


Nested Class Summary
protected  class NekoSimplifiedHtmlParser.DocumentHandler
          Handler for XNI events from Neko
 
Field Summary
 
Fields inherited from class org.apache.shindig.gadgets.parse.GadgetHtmlParser
documentFactory, PARSED_DOCUMENTS, PARSED_FRAGMENTS
 
Constructor Summary
NekoSimplifiedHtmlParser(DOMImplementation documentFactory)
           
 
Method Summary
protected  org.cyberneko.html.HTMLConfiguration newConfiguration()
           
protected  NekoSimplifiedHtmlParser.DocumentHandler newDocumentHandler(String source)
           
protected  Document parseDomImpl(String source)
          TODO: remove the need for parseDomImpl as a parsing method.
protected  DocumentFragment parseFragmentImpl(String source)
           
 
Methods inherited from class org.apache.shindig.gadgets.parse.GadgetHtmlParser
attemptFullDocParseFirst, errorDom, parseDom, parseFragment, prependToNode, setCacheProvider, setSerializerProvider, shouldCache, transferChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NekoSimplifiedHtmlParser

@Inject
public NekoSimplifiedHtmlParser(DOMImplementation documentFactory)
Method Detail

parseDomImpl

protected Document parseDomImpl(String source)
                         throws GadgetException
Description copied from class: GadgetHtmlParser
TODO: remove the need for parseDomImpl as a parsing method. Gadget HTML is tag soup handled in custom fashion, or is a legitimate fragment. In either case, we can simply use the fragment parsing implementation and patch up in higher-level calls.

Specified by:
parseDomImpl in class GadgetHtmlParser
Parameters:
source - a piece of HTML
Returns:
a Document parsed from the HTML
Throws:
GadgetException

parseFragmentImpl

protected DocumentFragment parseFragmentImpl(String source)
                                      throws GadgetException
Specified by:
parseFragmentImpl in class GadgetHtmlParser
Parameters:
source - a snippet of HTML markup
Returns:
a DocumentFragment containing the parsed elements
Throws:
GadgetException

newConfiguration

protected org.cyberneko.html.HTMLConfiguration newConfiguration()

newDocumentHandler

protected NekoSimplifiedHtmlParser.DocumentHandler newDocumentHandler(String source)


Copyright © 2007-2012. All Rights Reserved.