Back to project page MassRoute.
The source code is released under:
Copyright (c) 2010 Todd Anderson http://www.custardbelly.com/blog Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (th...
If you think the Android project MassRoute listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.custardbelly.massdot.parser.handler; //from ww w . j a v a 2 s . c om import org.xml.sax.Attributes; import org.xml.sax.helpers.DefaultHandler; public class MassRouteServiceParserHandler extends DefaultHandler { private boolean _isError; private String _errorMessage; private StringBuffer _errorMessageBuffer; @Override public void characters(char[] ch, int start, int length) { if ( _isError && _errorMessageBuffer != null ) { _errorMessageBuffer.append(ch, start, length); } } @Override public void startElement( String uri, String localName, String qName, Attributes attributes ) { if( localName.equalsIgnoreCase( "error" ) ) { _isError = true; _errorMessageBuffer = new StringBuffer(); } } @Override public void endDocument() { if( _isError && _errorMessageBuffer != null ) { _errorMessage = _errorMessageBuffer.toString().trim(); // TODO: Proper way to set for garbage collection? _errorMessageBuffer = null; } } public boolean hasError() { return _isError; } public String getErrorMessage() { return _errorMessage; } }