com.triangularpixels.rebirth.resources
Class XmlUtil

java.lang.Object
  extended by com.triangularpixels.rebirth.resources.XmlUtil

public class XmlUtil
extends Object

Handy-dandy utility methods for xml parsing


Constructor Summary
XmlUtil()
           
 
Method Summary
static Element getChild(Element parent, String name)
          Gets the child with the given node name, or null if it doesn't exist
static Element[] getChildElements(Element parent)
          Gets all the child elements of a given parent
static Element[] getChildElements(Element parent, String nodeName)
           
static Element getSingleChild(Element parent)
          Gets a single child element from a parent Returns null if there's less than or more than one child element
static Element parseXml(String xml)
           
static String[] splitArrayString(String input)
          Splits a string representing an array of values into sub string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlUtil

public XmlUtil()
Method Detail

parseXml

public static Element parseXml(String xml)

getChild

public static Element getChild(Element parent,
                               String name)
Gets the child with the given node name, or null if it doesn't exist


getSingleChild

public static Element getSingleChild(Element parent)
Gets a single child element from a parent Returns null if there's less than or more than one child element


getChildElements

public static Element[] getChildElements(Element parent)
Gets all the child elements of a given parent


getChildElements

public static Element[] getChildElements(Element parent,
                                         String nodeName)

splitArrayString

public static String[] splitArrayString(String input)
Splits a string representing an array of values into sub string. The input is split on any commas which are not surrounded by brackets. Eg. "1,2,3" becomes "1", "2", "3" "(x,y),[1,2,3]" becomes "(x,y)", "[1,2,3]"



Copyright © 2009 TriangularPixels.com. All Rights Reserved.