org.jasig.cas.client.util
Class XmlUtils

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

public final class XmlUtils
extends java.lang.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 java.lang.String getTextForElement(java.lang.String xmlAsString, java.lang.String element)
          Retrieve the text for a specific element (when we know there is only one).
static java.util.List getTextForElements(java.lang.String xmlAsString, java.lang.String element)
          Retrieve the text for a group of elements.
static org.xml.sax.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 org.xml.sax.XMLReader getXmlReader()
Get an instance of an XML reader from the XMLReaderFactory.

Returns:
the XMLReader.

getTextForElements

public static java.util.List getTextForElements(java.lang.String xmlAsString,
                                                java.lang.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 java.lang.String getTextForElement(java.lang.String xmlAsString,
                                                 java.lang.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-2009 JA-SIG. All Rights Reserved.