1 package org.apache.ws.jaxme.impl; 2 3 import javax.xml.bind.ValidationEvent; 4 5 import org.apache.ws.jaxme.ValidationEvents; 6 import org.xml.sax.Attributes ; 7 import org.xml.sax.SAXException ; 8 9 10 15 public abstract class JMSAXGroupParser { 16 protected abstract JMUnmarshallerHandlerImpl getHandler(); 17 18 21 public abstract boolean startElement(String pNamespaceURI, String pLocalName, String pQName, 22 Attributes pAttrs) throws SAXException ; 23 27 public abstract void endElement(String pNamespaceURI, String pLocalName, 28 String pQName, Object pResult) throws SAXException ; 29 30 32 public abstract boolean isFinished(); 33 34 private boolean isEmpty(char[] pChars, int pOffset, int pLen) { 35 for (int i = 0; i < pLen; i++) { 36 if (!Character.isWhitespace(pChars[pOffset+i])) { 37 return false; 38 } 39 } 40 return true; 41 } 42 43 45 public boolean isMixed() { 46 return false; 47 } 48 49 58 public void addText(char[] pChars, int pOffset, int pLen) throws SAXException { 59 if (!isEmpty(pChars, pOffset, pLen)) { 60 if (pLen > 100) { 61 pLen = 100; } 63 getHandler().validationEvent(ValidationEvent.WARNING, "Unexpected non-whitespace characters: '" + 64 new String (pChars, pOffset, pLen) + "'", 65 ValidationEvents.EVENT_UNEXPECTED_TEXTUAL_CONTENTS, 66 null); 67 } 68 } 69 } 70 | Popular Tags |