org.fife.ui.autocomplete
Class CompletionXMLParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.fife.ui.autocomplete.CompletionXMLParser
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class CompletionXMLParser
extends DefaultHandler

Parser for an XML file describing a procedural language such as C.

Error checking is minimal to non-existent; that will be handled via a schema in the future.

Version:
1.0
Author:
Robert Futrell

Constructor Summary
CompletionXMLParser(CompletionProvider provider)
          Constructor.
CompletionXMLParser(CompletionProvider provider, ClassLoader cl)
          Constructor.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Called when character data inside an element is found.
 void endElement(String uri, String localName, String qName)
          Called when an element is closed.
 List getCompletions()
          Returns the completions found after parsing the XML.
 char getParamEndChar()
          Returns the parameter end character specified.
 String getParamSeparator()
          Returns the parameter end string specified.
 char getParamStartChar()
          Returns the parameter start character specified.
 void reset(CompletionProvider provider)
          Resets this parser to grab more completions.
static void setDefaultCompletionClassLoader(ClassLoader cl)
          Sets the class loader to use when loading custom classes to use for various Completion types, such as FunctionCompletions, from XML.
 void startElement(String uri, String localName, String qName, Attributes attrs)
          Called when an element starts.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, 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

CompletionXMLParser

public CompletionXMLParser(CompletionProvider provider)
Constructor.

Parameters:
provider - The provider to get completions for.
See Also:
reset(CompletionProvider)

CompletionXMLParser

public CompletionXMLParser(CompletionProvider provider,
                           ClassLoader cl)
Constructor.

Parameters:
provider - The provider to get completions for.
cl - The class loader to use, if necessary, when loading classes from the XML (custom FunctionCompletions, for example). This may be null if the default is to be used, or if the XML does not define specific classes for completion types.
See Also:
reset(CompletionProvider)
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
Called when character data inside an element is found.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
Called when an element is closed.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler

getCompletions

public List getCompletions()
Returns the completions found after parsing the XML.

Returns:
The completions.

getParamEndChar

public char getParamEndChar()
Returns the parameter end character specified.

Returns:
The character, or 0 if none was specified.

getParamSeparator

public String getParamSeparator()
Returns the parameter end string specified.

Returns:
The string, or null if none was specified.

getParamStartChar

public char getParamStartChar()
Returns the parameter start character specified.

Returns:
The character, or 0 if none was specified.

reset

public void reset(CompletionProvider provider)
Resets this parser to grab more completions.

Parameters:
provider - The new provider to get completions for.

setDefaultCompletionClassLoader

public static void setDefaultCompletionClassLoader(ClassLoader cl)
Sets the class loader to use when loading custom classes to use for various Completion types, such as FunctionCompletions, from XML.

Users should very rarely have a need to use this method.

Parameters:
cl - The class loader to use. If this is null, then a default is used.

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attrs)
Called when an element starts.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler


Copyright © 2003-2011. All Rights Reserved.