org.eclipse.update.core.model
Class DefaultFeatureParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.eclipse.update.core.model.DefaultFeatureParser
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class DefaultFeatureParser
extends DefaultHandler

Default feature parser. Parses the feature manifest file as defined by the platform. Defers to a model factory to create the actual concrete model objects. The update framework supplies two factory implementations:

Since:
2.0

Constructor Summary
DefaultFeatureParser()
          Constructs a feature parser.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Handle character text
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
          Handle end of element tags
 void error(SAXParseException ex)
          Handle errors
 void fatalError(SAXParseException ex)
          Handle fatal errors
 MultiStatus getStatus()
          Returns all status objects accumulated by the parser.
 void ignorableWhitespace(char[] arg0, int arg1, int arg2)
          Receive notification of ignorable whitespace in element content.
 void init(FeatureModelFactory factory)
           
 void init(FeatureModelFactory factory, java.lang.String location)
           
 FeatureModel parse(java.io.InputStream in)
          Parses the specified input steam and constructs a feature model.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, Attributes attributes)
          Handle start of element tags
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFeatureParser

public DefaultFeatureParser()
Constructs a feature parser.

Since:
2.0
Method Detail

init

public void init(FeatureModelFactory factory)

init

public void init(FeatureModelFactory factory,
                 java.lang.String location)
Parameters:
factory -
location -
Since:
3.1

parse

public FeatureModel parse(java.io.InputStream in)
                   throws SAXException,
                          java.io.IOException
Parses the specified input steam and constructs a feature model. The input stream is not closed as part of this operation.

Parameters:
in - input stream
Returns:
feature model
Throws:
SAXException
java.io.IOException
Since:
2.0

getStatus

public MultiStatus getStatus()
Returns all status objects accumulated by the parser.

Returns:
multi-status containing accumulated status, or null.
Since:
2.0

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         Attributes attributes)
                  throws SAXException
Handle start of element tags

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
attributes - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException - any SAX exception, possibly wrapping another exception
Since:
2.0
See Also:
DefaultHandler.startElement(String, String, String, Attributes)

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
Handle end of element tags

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The qualified name (with prefix), or the empty string if qualified names are not available.
Since:
2.0
See Also:
DefaultHandler.endElement(String, String, String)

characters

public void characters(char[] ch,
                       int start,
                       int length)
Handle character text

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Parameters:
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
Since:
2.0
See Also:
DefaultHandler.characters(char[], int, int)

error

public void error(SAXParseException ex)
Handle errors

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Parameters:
ex - The warning information encoded as an exception.
Since:
2.0
See Also:
DefaultHandler.error(SAXParseException)

fatalError

public void fatalError(SAXParseException ex)
                throws SAXException
Handle fatal errors

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Parameters:
ex - The error information encoded as an exception.
Throws:
SAXException
Since:
2.0
See Also:
DefaultHandler.fatalError(SAXParseException)

ignorableWhitespace

public void ignorableWhitespace(char[] arg0,
                                int arg1,
                                int arg2)
                         throws SAXException
Description copied from class: DefaultHandler
Receive notification of ignorable whitespace in element content.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of ignorable whitespace (such as adding data to a node or buffer, or printing it to a file).

Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class DefaultHandler
Parameters:
arg0 - The whitespace characters.
arg1 - The start position in the character array.
arg2 - The number of characters to use from the character array.
Throws:
SAXException - any SAX exception, possibly wrapping another exception
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)