org.jasig.cas.client.util
Class XmlUtils

java.lang.Object
  extended by org.jasig.cas.client.util.XmlUtils

public final class XmlUtils
extends Object

Common utilities for easily parsing XML without duplicating logic.

Since:
3.0
Version:
$Revision: 11729 $ $Date: 2007-09-26 14:22:30 -0400 (Tue, 26 Sep 2007) $
Author:
Scott Battaglia

Constructor Summary
XmlUtils()
           
 
Method Summary
static String getTextForElement(String xmlAsString, String element)
          Retrieve the text for a specific element (when we know there is only one).
static List<String> getTextForElements(String xmlAsString, String element)
          Retrieve the text for a group of elements.
static XMLReader getXmlReader()
          Get an instance of an XML reader from the XMLReaderFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlUtils

public XmlUtils()
Method Detail

getXmlReader

public static XMLReader getXmlReader()
Get an instance of an XML reader from the XMLReaderFactory.

Returns:
the XMLReader.

getTextForElements

public static List<String> getTextForElements(String xmlAsString,
                                              String element)
Retrieve the text for a group of elements. Each text element is an entry in a list.

This method is currently optimized for the use case of two elements in a list.

Parameters:
xmlAsString - the xml response
element - the element to look for
Returns:
the list of text from the elements.

getTextForElement

public static String getTextForElement(String xmlAsString,
                                       String element)
Retrieve the text for a specific element (when we know there is only one).

Parameters:
xmlAsString - the xml response
element - the element to look for
Returns:
the text value of the element.


Copyright © 2006-2011 Jasig. All Rights Reserved.