public class XMLParseUtil extends Object
Modifier and Type | Method and Description |
---|---|
static double |
findDouble(String val)
Searches the given string for the first floating point number it contains,
parses and returns it.
|
static float |
findFloat(String val)
Searches the given string for the first floating point number it contains,
parses and returns it.
|
static int |
findInt(String val)
Searches the given string for the first integer point number it contains,
parses and returns it.
|
static boolean |
getAttribBoolean(Element ele,
String name)
Parses the given attribute of this tag and returns it as a boolean.
|
static double |
getAttribDouble(Element ele,
String name)
Parses the given attribute of this tag and returns it as a double.
|
static float |
getAttribFloat(Element ele,
String name)
Parses the given attribute of this tag and returns it as a float
|
static int |
getAttribInt(Element ele,
String name)
Parses the given attribute of this tag and returns it as an int.
|
static int |
getAttribIntHex(Element ele,
String name)
Parses the given attribute of this tag as a hexadecimal encoded string and
returns it as an int
|
static String |
getAttribString(Element ele,
String name)
Parses the given attribute of this tag and returns it as a String.
|
static URL |
getAttribURL(Element ele,
String name,
URL docRoot) |
static ReadableXMLElement |
getElement(Class classType,
Element root,
String name,
URL docRoot)
Returns the first ReadableXMLElement with the given name
|
static Object[] |
getElementArray(Class classType,
Element root,
String name,
URL docRoot) |
static int[] |
getElementArrayInt(Element root,
String name,
String attrib)
Takes a number of tags of name 'name' that are children of 'root', and
looks for attributes of 'attrib' on them.
|
static String[] |
getElementArrayString(Element root,
String name,
String attrib)
Takes a number of tags of name 'name' that are children of 'root', and
looks for attributes of 'attrib' on them.
|
static HashMap |
getElementHashMap(Class classType,
Element root,
String name,
String key,
URL docRoot)
Returns a HashMap of nodes that are children of root.
|
static HashSet |
getElementHashSet(Class classType,
Element root,
String name,
URL docRoot) |
static LinkedList |
getElementLinkedList(Class classType,
Element root,
String name,
URL docRoot) |
static Element |
getFirstChild(Element root,
String name)
Returns the first node that is a direct child of root with the coresponding
name.
|
static String |
getTagText(Element ele)
Scans the tag's children and returns the first text element found
|
static boolean |
isDouble(String val) |
static double |
parseDouble(String val) |
static double[] |
parseDoubleList(String list)
Scans an input string for double values.
|
static float |
parseFloat(String val) |
static float[] |
parseFloatList(String list) |
static int |
parseInt(String val) |
static int[] |
parseIntList(String list) |
static NumberWithUnits |
parseNumberWithUnits(String val) |
static double |
parseRatio(String val)
The input string represents a ratio.
|
static String[] |
parseStringList(String list) |
static HashMap |
parseStyle(String styleString)
Takes a CSS style string and retursn a hash of them.
|
static HashMap |
parseStyle(String styleString,
HashMap map)
Takes a CSS style string and returns a hash of them.
|
public static String getTagText(Element ele)
public static Element getFirstChild(Element root, String name)
public static String[] parseStringList(String list)
public static double parseDouble(String val)
public static double findDouble(String val)
public static double[] parseDoubleList(String list)
public static float parseFloat(String val)
public static float findFloat(String val)
public static float[] parseFloatList(String list)
public static int findInt(String val)
public static int[] parseIntList(String list)
public static double parseRatio(String val)
public static NumberWithUnits parseNumberWithUnits(String val)
public static String getAttribString(Element ele, String name)
public static int getAttribInt(Element ele, String name)
public static int getAttribIntHex(Element ele, String name)
public static float getAttribFloat(Element ele, String name)
public static double getAttribDouble(Element ele, String name)
public static boolean getAttribBoolean(Element ele, String name)
public static URL getAttribURL(Element ele, String name, URL docRoot)
public static ReadableXMLElement getElement(Class classType, Element root, String name, URL docRoot)
public static HashMap getElementHashMap(Class classType, Element root, String name, String key, URL docRoot)
public static HashSet getElementHashSet(Class classType, Element root, String name, URL docRoot)
public static LinkedList getElementLinkedList(Class classType, Element root, String name, URL docRoot)
public static Object[] getElementArray(Class classType, Element root, String name, URL docRoot)
public static int[] getElementArrayInt(Element root, String name, String attrib)
public static String[] getElementArrayString(Element root, String name, String attrib)
public static HashMap parseStyle(String styleString)
styleString
- - A CSS formatted string of styles. Eg,
"font-size:12;fill:#d32c27;fill-rule:evenodd;stroke-width:1pt;"public static HashMap parseStyle(String styleString, HashMap map)
styleString
- - A CSS formatted string of styles. Eg,
"font-size:12;fill:#d32c27;fill-rule:evenodd;stroke-width:1pt;"map
- - A map to which these styles will be addedCopyright ?? 2011-2015 Kitfox Studios. All Rights Reserved.