Package net.sourceforge.jnlp
Class Parser
java.lang.Object
net.sourceforge.jnlp.Parser
Contains methods to parse an XML document into a JNLPFile. Implements JNLP
specification version 1.0.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addInfo
(InformationDesc info, Node node, String mod, Object value) Adds a key,value pair to the information object.Returns the file location.Returns the file version.getLauncher
(Node parent) Returns aLocale
from a single locale.static Object
getParserInstance
(ParserSettings settings) getResources
(Node parent, boolean j2se) static Node
getRootNode
(InputStream input, ParserSettings settings) getSecurity
(Node parent) static URL
-
Field Details
-
MALFORMED_PARSER_CLASS
- See Also:
-
NORMAL_PARSER_CLASS
- See Also:
-
-
Constructor Details
-
Parser
Create a parser for the JNLP file. If the location parameters is not null it is used as the default codebase (does not override value of jnlp element's href attribute).The root node may be normalized as a side effect of this constructor.
- Parameters:
file
- the (uninitialized) file referencebase
- if codebase is not specified, a default base for relative URLsroot
- the root nodesettings
- the parser settings to use when parsing the JNLP file- Throws:
ParseException
- if the JNLP file is invalid
-
Parser
public Parser(JNLPFile file, URL base, Node root, ParserSettings settings, URL codebase) throws ParseException Create a parser for the JNLP file. If the location parameters is not null it is used as the default codebase (does not override value of jnlp element's href attribute).The root node may be normalized as a side effect of this constructor.
- Parameters:
file
- the (uninitialized) file referencebase
- if codebase is not specified, a default base for relative URLsroot
- the root nodesettings
- the parser settings to use when parsing the JNLP filecodebase
- codebase to use if we did not parse one from JNLP file.- Throws:
ParseException
- if the JNLP file is invalid
-
-
Method Details
-
getFileVersion
Returns the file version.- Returns:
- version of file
-
getFileLocation
Returns the file location.- Returns:
- url of source file
-
getCodeBase
- Returns:
- the codebase.
-
getSpecVersion
- Returns:
- the specification version.
-
getResources
- Parameters:
parent
- the parent node (either jnlp or j2se)j2se
- true if the resources are located under a j2se or java node- Returns:
- all of the ResourcesDesc elements under the specified node (jnlp or j2se).
- Throws:
ParseException
- if the JNLP file is invalid
-
getInfo
- Parameters:
parent
- the parent node (jnlp)- Returns:
- all of the information elements under the specified node.
- Throws:
ParseException
- if the JNLP file is invalid
-
addInfo
Adds a key,value pair to the information object.- Parameters:
info
- the information objectnode
- node name to be used as the keymod
- key name appended with "-"+mod if not nullvalue
- the info object to add (icon or string)
-
getSecurity
- Parameters:
parent
- the parent node- Returns:
- the security descriptor element. If no security element was specified in the JNLP file then a SecurityDesc with applet permissions is returned.
- Throws:
ParseException
- if the JNLP file is invalid
-
getLauncher
- Parameters:
parent
- the parent node- Returns:
- the launch descriptor element, either AppletDesc, ApplicationDesc, or InstallerDesc.
- Throws:
ParseException
- if the JNLP file is invalid
-
getLocale
Returns aLocale
from a single locale.- Parameters:
localeStr
- the locale string- Returns:
- locale of document
-
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
-
getRootNode
- Returns:
- the root node from the XML document in the specified input stream.
- Throws:
ParseException
- if the JNLP file is invalid
-
getParserInstance
public static Object getParserInstance(ParserSettings settings) throws ClassNotFoundException, IllegalAccessException, InstantiationException
-