de.nava.informa.utils
Class AtomParserUtils

java.lang.Object
  extended by de.nava.informa.utils.AtomParserUtils

public class AtomParserUtils
extends Object

Common utility functions for Atom 0.3 and Atom 1.0 parser


Field Summary
static org.apache.commons.logging.Log LOGGER
           
 
Constructor Summary
AtomParserUtils()
           
 
Method Summary
static String getItemLink(org.jdom.Element item, org.jdom.Namespace defNS)
          Looks for link sub-elements of type "link" and selects the most preferred.
static int getPreferenceOrderForItemLinkType(String type, String rel)
          Returns order of item link type preference.
static String getValue(org.jdom.Element elt, String mode)
          Returns value of the element.
static List trimContents(List contents)
          Cuts all empty (whitespace) text blocks from the head and tail of contents list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

public static final org.apache.commons.logging.Log LOGGER
Constructor Detail

AtomParserUtils

public AtomParserUtils()
Method Detail

getItemLink

public static String getItemLink(org.jdom.Element item,
                                 org.jdom.Namespace defNS)
Looks for link sub-elements of type "link" and selects the most preferred.

Parameters:
item - item element.
defNS - default namespace.
Returns:
link in string or null.

getPreferenceOrderForItemLinkType

public static int getPreferenceOrderForItemLinkType(String type,
                                                    String rel)
Returns order of item link type preference.

Parameters:
type - type ("text/html", "text/plain", "application/xml" ...).
Returns:
order (the lower the more preferred).

getValue

public static String getValue(org.jdom.Element elt,
                              String mode)
Returns value of the element.

Parameters:
elt - the element to retrieve the value from.
mode - can be one of "escaped", "base64" or "xml". If null, "xml" is assumed.

trimContents

public static List trimContents(List contents)
Cuts all empty (whitespace) text blocks from the head and tail of contents list.

Parameters:
contents - list of contents.
Returns:
trimmed version.


Copyright © 2002-2007 Niko Schmuck. All Rights Reserved.