org.apache.shindig.gadgets.parse
Class HtmlSerialization

java.lang.Object
  extended by org.apache.shindig.gadgets.parse.HtmlSerialization

public class HtmlSerialization
extends Object

Static class with helpers to manage serialization of a Document. Binds an HtmlSerializer to a Document as user data, and pulls it out to achieve actual serialization.


Field Summary
static String KEY
          Used to key an instance of HtmlSerializer in document.getUserData
static Set<String> URL_ATTRIBUTES
           
 
Constructor Summary
HtmlSerialization()
           
 
Method Summary
static void attach(Document doc, HtmlSerializer serializer, String originalContent)
          Attach a serializer instance to the document
static StringWriter createWriter(Document doc)
          Create a writer sized to the original length of the document
static boolean isUrlAttribute(org.apache.xerces.xni.QName name, String attributeName)
          Returns true if the listed attribute is an URL attribute.
static void printEscapedText(CharSequence text, Appendable output)
           
static String serialize(Document doc)
          Call the attached serializer and output the document
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY

public static final String KEY
Used to key an instance of HtmlSerializer in document.getUserData

See Also:
Constant Field Values

URL_ATTRIBUTES

public static final Set<String> URL_ATTRIBUTES
Constructor Detail

HtmlSerialization

public HtmlSerialization()
Method Detail

attach

public static void attach(Document doc,
                          HtmlSerializer serializer,
                          String originalContent)
Attach a serializer instance to the document

Parameters:
doc -
serializer -
originalContent - may be null

createWriter

public static StringWriter createWriter(Document doc)
Create a writer sized to the original length of the document

Parameters:
doc -
Returns:

serialize

public static String serialize(Document doc)
Call the attached serializer and output the document

Parameters:
doc -
Returns:

printEscapedText

public static void printEscapedText(CharSequence text,
                                    Appendable output)
                             throws IOException
Throws:
IOException

isUrlAttribute

public static boolean isUrlAttribute(org.apache.xerces.xni.QName name,
                                     String attributeName)
Returns true if the listed attribute is an URL attribute.



Copyright © 2007-2012. All Rights Reserved.