com.google.code.facebookapi
Class XmlHelper

java.lang.Object
  extended by com.google.code.facebookapi.XmlHelper

public class XmlHelper
extends java.lang.Object


Constructor Summary
XmlHelper()
           
 
Method Summary
static boolean extractBoolean(org.w3c.dom.Node result)
          Extracts a Boolean from a result that consists of a Boolean only.
static int extractInt(org.w3c.dom.Node doc)
          Extracts an Integer from a document that consists of an Integer only.
static java.lang.Long extractLong(org.w3c.dom.Node doc)
          Extracts a Long from a document that consists of a Long only.
static java.lang.String extractString(org.w3c.dom.Node d)
          Extracts a String from a Document consisting entirely of a String.
static org.w3c.dom.Document parseCallResult(org.w3c.dom.Document doc)
          Used in the context of optimisation.
static org.w3c.dom.Document parseCallResult(java.lang.Object rawResponse, javax.xml.parsers.DocumentBuilderFactory factory)
           
static java.lang.String printDom(org.w3c.dom.Node n, java.lang.String prefix)
           
static void printDom(org.w3c.dom.Node n, java.lang.String prefix, java.lang.StringBuilder sb)
          Prints out the DOM tree.
static void stripEmptyTextNodes(org.w3c.dom.Node n)
          Hack...since DOM reads newlines as textnodes we want to strip out those nodes to make it easier to use the tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlHelper

public XmlHelper()
Method Detail

printDom

public static java.lang.String printDom(org.w3c.dom.Node n,
                                        java.lang.String prefix)

printDom

public static void printDom(org.w3c.dom.Node n,
                            java.lang.String prefix,
                            java.lang.StringBuilder sb)
Prints out the DOM tree.

Parameters:
n - the parent node to start printing from
prefix - string to append to output, should not be null

extractString

public static java.lang.String extractString(org.w3c.dom.Node d)
Extracts a String from a Document consisting entirely of a String.

Returns:
the String

extractInt

public static int extractInt(org.w3c.dom.Node doc)
Extracts an Integer from a document that consists of an Integer only.

Parameters:
doc -
Returns:
the Integer

extractLong

public static java.lang.Long extractLong(org.w3c.dom.Node doc)
Extracts a Long from a document that consists of a Long only.

Parameters:
doc -
Returns:
the Long

extractBoolean

public static boolean extractBoolean(org.w3c.dom.Node result)
Extracts a Boolean from a result that consists of a Boolean only.

Parameters:
result -
Returns:
the Boolean

parseCallResult

public static org.w3c.dom.Document parseCallResult(java.lang.Object rawResponse,
                                                   javax.xml.parsers.DocumentBuilderFactory factory)
                                            throws FacebookException
Throws:
FacebookException

stripEmptyTextNodes

public static void stripEmptyTextNodes(org.w3c.dom.Node n)
Hack...since DOM reads newlines as textnodes we want to strip out those nodes to make it easier to use the tree.


parseCallResult

public static org.w3c.dom.Document parseCallResult(org.w3c.dom.Document doc)
                                            throws FacebookException
Used in the context of optimisation. If we already have an XML snippet, it's not sensible to convert it to a string and then convert it back to a document.

Parameters:
doc -
Returns:
Throws:
FacebookException


Copyright © 2010. All Rights Reserved.