org.iscreen.impl.xml
Class XmlParser

java.lang.Object
  extended by org.iscreen.impl.xml.XmlParser

public class XmlParser
extends java.lang.Object

Parses XML configuration files. This is the parser for the default XML configuration file format. It requires an instance of the OgnlXmlServiceFactory in order to work properly. It calls back into the factory to notify it of configuration elements. This parser uses DOM (not SAX), though it treats the service factory more like SAX in that it notifies it of config events.

Author:
Shellman, Dan

Constructor Summary
XmlParser(XmlServiceFactory factory)
          Default constructor.
 
Method Summary
protected  org.w3c.dom.Document getDocument(java.io.InputStream stream)
          Constructs a DOM object that represents the stream provided.
protected  java.io.InputStream getInput(java.lang.String classpathLocation)
          Given a "location" which is a classpath-based resource, return an InputStream to it.
 void parse(java.lang.String configLocation)
          Parses the configuration file and calls back into the provided factory for configuration elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlParser

public XmlParser(XmlServiceFactory factory)
Default constructor.

Method Detail

parse

public void parse(java.lang.String configLocation)
Parses the configuration file and calls back into the provided factory for configuration elements.

Parameters:
configLocation - The classpath-based location of the config file.

getInput

protected java.io.InputStream getInput(java.lang.String classpathLocation)
Given a "location" which is a classpath-based resource, return an InputStream to it.

Parameters:
classpathLocation - The location of the input (must be available on the classpath).
Returns:
Returns an InputStream of the resource.

getDocument

protected org.w3c.dom.Document getDocument(java.io.InputStream stream)
Constructs a DOM object that represents the stream provided. The Document represents the XML of the stream.

Parameters:
stream - The input stream of the XML document.
Returns:
Returns the Document representing the DOM of the XML.