Class CompletionXMLParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.fife.ui.autocomplete.CompletionXMLParser
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Parser for an XML file describing a procedural language such as C. XML
files will be validated against the
CompletionXml.dtd DTD
found in this package.- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ClassLoaderThe completion provider to use when loading classes, such as customFunctionCompletions.private List<Completion> The completions found after parsing the XML.private static ClassLoaderThe class loader to use to load custom completion classes, such as the one defined byfuncCompletionType.private Stringprivate StringBuilderprivate booleanprivate booleanprivate StringIf specified in the XML, this class will be used instead ofFunctionCompletionwhen appropriate.private booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate booleanprivate Stringprivate StringBuilderprivate charprivate Stringprivate List<ParameterizedCompletion.Parameter> private Stringprivate charprivate Stringprivate CompletionProviderThe provider we're getting completions for.private Stringprivate StringBuilderprivate String -
Constructor Summary
ConstructorsConstructorDescriptionCompletionXMLParser(CompletionProvider provider) Constructor.CompletionXMLParser(CompletionProvider provider, ClassLoader cl) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) Called when character data inside an element is found.private FunctionCompletionprivate MarkupTagCompletionprivate BasicCompletionprivate VariableCompletionvoidendElement(String uri, String localName, String qName) Called when an element is closed.voidReturns the completions found after parsing the XML.charReturns the parameter end character specified.Returns the parameter end string specified.charReturns the parameter start character specified.private static chargetSingleChar(String str) voidreset(CompletionProvider provider) Resets this parser to grab more completions.resolveEntity(String publicID, String systemID) static voidSets the class loader to use when loading custom classes to use for variousCompletiontypes, such asFunctionCompletions, from XML.voidstartElement(String uri, String localName, String qName, Attributes attrs) Called when an element starts.voidMethods inherited from class DefaultHandler
endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDeclMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Field Details
-
completions
The completions found after parsing the XML. -
provider
The provider we're getting completions for. -
completionCL
The completion provider to use when loading classes, such as customFunctionCompletions. -
name
-
type
-
returnType
-
returnValDesc
-
desc
-
paramName
-
paramType
-
endParam
private boolean endParam -
paramDesc
-
params
-
definedIn
-
doingKeywords
private boolean doingKeywords -
inKeyword
private boolean inKeyword -
gettingReturnValDesc
private boolean gettingReturnValDesc -
gettingDesc
private boolean gettingDesc -
gettingParams
private boolean gettingParams -
inParam
private boolean inParam -
gettingParamDesc
private boolean gettingParamDesc -
inCompletionTypes
private boolean inCompletionTypes -
paramStartChar
private char paramStartChar -
paramEndChar
private char paramEndChar -
paramSeparator
-
funcCompletionType
If specified in the XML, this class will be used instead ofFunctionCompletionwhen appropriate. This class should extendFunctionCompletion, or stuff will break. -
defaultCompletionClassLoader
The class loader to use to load custom completion classes, such as the one defined byfuncCompletionType. If this isnull, then a default class loader is used. This field will usually benull.
-
-
Constructor Details
-
CompletionXMLParser
Constructor.- Parameters:
provider- The provider to get completions for.- See Also:
-
CompletionXMLParser
Constructor.- Parameters:
provider- The provider to get completions for.cl- The class loader to use, if necessary, when loading classes from the XML (customFunctionCompletions, for example). This may benullif the default is to be used, or if the XML does not define specific classes for completion types.- See Also:
-
-
Method Details
-
characters
public void characters(char[] ch, int start, int length) Called when character data inside an element is found.- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
createFunctionCompletion
-
createOtherCompletion
-
createMarkupTagCompletion
-
createVariableCompletion
-
endElement
Called when an element is closed.- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler
-
error
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
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
Returns the parameter end string specified.- Returns:
- The string, or
nullif none was specified.
-
getParamStartChar
public char getParamStartChar()Returns the parameter start character specified.- Returns:
- The character, or 0 if none was specified.
-
getSingleChar
-
reset
Resets this parser to grab more completions.- Parameters:
provider- The new provider to get completions for.
-
resolveEntity
- Specified by:
resolveEntityin interfaceEntityResolver- Overrides:
resolveEntityin classDefaultHandler
-
setDefaultCompletionClassLoader
Sets the class loader to use when loading custom classes to use for variousCompletiontypes, such asFunctionCompletions, from XML.Users should very rarely have a need to use this method.
- Parameters:
cl- The class loader to use. If this isnull, then a default is used.
-
startElement
Called when an element starts.- Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler
-
warning
- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler- Throws:
SAXException
-