Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.fife.ui.autocomplete;
  
  import java.util.List;
Parser for an XML file describing a procedural language such as C.

Author(s):
Robert Futrell
Version:
1.0
 
 class CompletionXMLParser extends DefaultHandler {

The completions found after parsing the XML.
 
 	private List completions;

The provider we're getting completions for.
 
 
 	private String name;
 	private String type;
 	private String returnType;
 	private StringBuffer desc;
 	private String paramName;
 	private String paramType;
 	private List params;
 	private String definedIn;
 	private boolean doingKeywords;
 	private boolean inKeyword;
 	private boolean gettingReturnValDesc;
 	private boolean gettingDesc;
 	private boolean gettingParams;
 	private boolean inParam;
 	private boolean gettingParamDesc;
 	private char paramStartChar;
 	private char paramEndChar;
 	private String paramSeparator;


Constructor.

Parameters:
provider The provider to get completions for.
See also:
reset(org.fife.ui.autocomplete.CompletionProvider)
 
 	public CompletionXMLParser(CompletionProvider provider) {
 		this. = provider;
 		 = new ArrayList();
 		 = new ArrayList(1);
 		 = new StringBuffer();
 		 = new StringBuffer();
 		 = null;
 	}


Called when character data inside an element is found.
 
 	public void characters(char[] chint startint length) {
 		if () {
 			.append(chstartlength);
 		}
 		else if () {
 			.append(chstartlength);
 		}
 		else if () {
 			.append(chstartlength);
 		}
 	}
 
 
 		if (.length()>0) {
 		}
 		if (.length()>0) {
 		}
 		return fc;
 	}
 
 
		if (.length()>0) {
		}
		return mc;
	}
		if (.length()>0) {
		}
		return vc;
	}


Called when an element is closed.
	public void endElement(String uriString localNameString qName) {
		if ("keywords".equals(qName)) {
			 = false;
		}
		else if () {
			if ("keyword".equals(qName)) {
				Completion c = null;
				if ("function".equals()) {
				}
				else if ("constant".equals()) {
				}
				else if ("tag".equals()) { // Markup tag, such as HTML
				}
				else {
					throw new InternalError("Unexpected type: " + );
				}
				 = false;
			}
			else if () {
				if ("returnValDesc".equals(qName)) {
				}
				else if () {
					if ("params".equals(qName)) {
						 = false;
					}
					else if ("param".equals(qName)) {
						if (.length()>0) {
						}
						.add(param);
						 = false;
					}
					else if () {
						if ("desc".equals(qName)) {
						}
					}
				}
				else if ("desc".equals(qName)) {
					 = false;
				}
			}
		}
	}


Returns the completions found after parsing the XML.

Returns:
The completions.
	public List getCompletions() {
		return ;
	}


Returns the parameter end character specified.

Returns:
The character, or 0 if none was specified.
	public char getParamEndChar() {
		return ;
	}


Returns the parameter end string specified.

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


Returns the parameter start character specified.

Returns:
The character, or 0 if none was specified.
	public char getParamStartChar() {
	}


Resets this parser to grab more completions.

Parameters:
provider The new provider to get completions for.
	public void reset(CompletionProvider provider) {
		this. = provider;
	}


Called when an element starts.
	public void startElement(String uriString localNameString qName,
							Attributes attrs) { 
		if ("keywords".equals(qName)) {
			 = true;
		}
		else if () {
			if ("keyword".equals(qName)) {
				 = attrs.getValue("name");
				 = attrs.getValue("type");
				 = attrs.getValue("returnType");
				 = attrs.getValue("definedIn");
				 = true;
			}
			else if () {
				if ("returnValDesc".equals(qName)) {
				}
				else if ("params".equals(qName)) {
					 = true;
				}
				else if () {
					if ("param".equals(qName)) {
						 = attrs.getValue("name");
						 = attrs.getValue("type");
						 = true;
					}
					if () {
						if ("desc".equals(qName)) {
						}
					}
				}
				else if ("desc".equals(qName)) {
					 = true;
				}
			}
		}
		else if ("environment".equals(qName)) {
			 = attrs.getValue("paramStartChar").charAt(0);
			 = attrs.getValue("paramEndChar").charAt(0);
			 = attrs.getValue("paramSeparator");
			//paramTerminal = attrs.getValua("terminal");
		}
	}
New to GrepCode? Check out our FAQ X