public final class XmlUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
getAttribute(Node node,
String attr) |
static String |
getAttribute(Node node,
String attr,
String def)
Extracts an attribute from a node.
|
static boolean |
getBoolAttribute(Node node,
String attr) |
static boolean |
getBoolAttribute(Node node,
String attr,
boolean def)
Retrieves an attribute as a boolean.
|
static Uri |
getHttpUriAttribute(Node node,
String attr,
Uri base)
Retrieves an attribute as a URI, and verifies that the URI is an http or https URI.
|
static Uri |
getHttpUriAttribute(Node node,
String attr,
Uri base,
Uri def)
Retrieves an attribute as a URI, and verifies that the URI is an http
or https URI.
|
static int |
getIntAttribute(Node node,
String attr) |
static int |
getIntAttribute(Node node,
String attr,
int def) |
static Uri |
getUriAttribute(Node node,
String attr)
Retrieves an attribute as a URI.
|
static Uri |
getUriAttribute(Node node,
String attr,
Uri def)
Retrieves an attribute as a URI.
|
static Element |
parse(String xml)
Attempts to parse the input xml into a single element.
|
static Element |
parseSilent(String xml)
Same as
parse(String), but throws a RuntimeException instead of XmlException. |
public static String getAttribute(Node node, String attr, String def)
node - attr - def - public static String getAttribute(Node node, String attr)
node - attr - public static Uri getUriAttribute(Node node, String attr, Uri def)
node - attr - public static Uri getUriAttribute(Node node, String attr)
node - attr - public static Uri getHttpUriAttribute(Node node, String attr, Uri base, Uri def)
node - attr - base - def - @return the parsed uri, or def if the attribute is not a valid http or
https URI.public static Uri getHttpUriAttribute(Node node, String attr, Uri base)
node - attr - base - public static boolean getBoolAttribute(Node node, String attr, boolean def)
node - attr - def - public static boolean getBoolAttribute(Node node, String attr)
node - attr - public static int getIntAttribute(Node node, String attr, int def)
public static int getIntAttribute(Node node, String attr)
public static Element parse(String xml) throws XmlException
xml - XmlException - if a parse error occured.public static Element parseSilent(String xml)
parse(String), but throws a RuntimeException instead of XmlException.Copyright © 2007-2012. All Rights Reserved.