TypeParserImpl.java
Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one
00003  * or more contributor license agreements.  See the NOTICE file
00004  * distributed with this work for additional information
00005  * regarding copyright ownership.  The ASF licenses this file
00006  * to you under the Apache License, Version 2.0 (the
00007  * "License"); you may not use this file except in compliance
00008  * with the License.  You may obtain a copy of the License at
00009  *
00010  *   http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing,
00013  * software distributed under the License is distributed on an
00014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00015  * KIND, either express or implied.  See the License for the
00016  * specific language governing permissions and limitations
00017  * under the License.    
00018  */
00019 package org.apache.xmlrpc.parser;
00020 
00021 import org.apache.xmlrpc.XmlRpcException;
00022 import org.xml.sax.Locator;
00023 import org.xml.sax.SAXException;
00024 import org.xml.sax.SAXParseException;
00025 
00026 
00030 public abstract class TypeParserImpl implements TypeParser {
00031         private Object result;
00032         private Locator locator;
00033 
00037         public void setResult(Object pResult) { result = pResult; }
00038         public Object getResult() throws XmlRpcException { return result; }
00039 
00044         public Locator getDocumentLocator() { return locator; }
00045         public void setDocumentLocator(Locator pLocator) { locator = pLocator; }
00046 
00049         public void processingInstruction(String pTarget, String pData) throws SAXException {
00050         }
00051 
00054         public void skippedEntity(String pName) throws SAXException {
00055                 throw new SAXParseException("Don't know how to handle entity " + pName,
00056                                                                         getDocumentLocator());
00057         }
00058 
00059         public void startPrefixMapping(String pPrefix, String pURI) throws SAXException {
00060         }
00061 
00062         public void endPrefixMapping(String pPrefix) throws SAXException {
00063         }
00064 
00065         public void endDocument() throws SAXException {
00066         }
00067 
00068         public void startDocument() throws SAXException {
00069         }
00070 
00071         protected static boolean isEmpty(char[] pChars, int pStart, int pLength) {
00072                 for (int i = 0;  i < pLength;  i++) {
00073                         if (!Character.isWhitespace(pChars[pStart+i])) {
00074                                 return false;
00075                         }
00076                 }
00077                 return true;
00078         }
00079 
00080         public void characters(char[] pChars, int pOffset, int pLength) throws SAXException {
00081                 if (!isEmpty(pChars, pOffset, pLength)) {
00082                         throw new SAXParseException("Unexpected non-whitespace character data",
00083                                                                                 getDocumentLocator());
00084                 }
00085         }
00086 
00087         public void ignorableWhitespace(char[] pChars, int pOffset, int pLength) throws SAXException {
00088         }
00089 }


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:49