Class NodeUtils
java.lang.Object
net.adoptopenjdk.icedteaweb.xmlparser.NodeUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetAttribute(XmlNode node, String name, String defaultValue) static XmlNodegetChildNode(XmlNode node, String name) Returns the first child node with the specified name.static XmlNode[]getChildNodes(XmlNode node, String name) Returns all child nodes with the specified name.static StringgetRequiredAttribute(XmlNode node, String name, String defaultValue, boolean strict) static URLgetRequiredURL(XmlNode node, String name, URL base, boolean strict) static StringgetSpanText(XmlNode node) Returns the implied text under a node, for example "text" in "<description>text</description>".static StringgetSpanText(XmlNode node, boolean preserveSpacing) Returns the implied text under a node, for example "text" in "<description>text</description>".static URLstatic URL
-
Constructor Details
-
NodeUtils
public NodeUtils()
-
-
Method Details
-
getChildNode
-
getChildNodes
-
getSpanText
-
getSpanText
Returns the implied text under a node, for example "text" in "<description>text</description>". If preserveSpacing is false, sequences of whitespace characters are turned into a single space character.- Parameters:
node- the node with text under itpreserveSpacing- if true, preserve whitespace
-
getAttribute
-
getRequiredAttribute
public static String getRequiredAttribute(XmlNode node, String name, String defaultValue, boolean strict) throws ParseException - Parameters:
node- the nodename- the attributedefaultValue- default value- Returns:
- the same result as getAttribute except that if strict mode is enabled or the default value is null a parse exception is thrown instead of returning the default value.
- Throws:
ParseException- if the attribute does not exist or is empty
-
getRequiredURL
public static URL getRequiredURL(XmlNode node, String name, URL base, boolean strict) throws ParseException - Parameters:
node- the nodename- the attribute containing an hrefbase- the base URL- Returns:
- the same result as getURL except that a ParseException is thrown if the attribute is null or empty.
- Throws:
ParseException- if the JNLP file is invalid
-
getURL
- Parameters:
node- the nodename- the attribute containing an hrefbase- the base URL- Returns:
- a URL object from a href string relative to the code base. If the href denotes a relative URL, it must reference a location that is a subdirectory of the codebase.
- Throws:
ParseException- if the JNLP file is invalid
-
getURL
public static URL getURL(String href, String nodeName, URL base, boolean strict) throws ParseException - Throws:
ParseException
-