1 11 12 package org.eclipse.pde.internal.core.schema; 13 14 import java.io.StringReader ; 15 import java.util.LinkedList ; 16 17 import org.xml.sax.Attributes ; 18 import org.xml.sax.InputSource ; 19 import org.xml.sax.SAXException ; 20 import org.xml.sax.helpers.DefaultHandler ; 21 22 26 public class BaseSchemaHandler extends DefaultHandler { 27 28 protected LinkedList fElementList; 29 30 public BaseSchemaHandler() { 31 reset(); 32 } 33 34 protected void reset() { 35 fElementList = new LinkedList (); 36 } 37 38 public void startDocument() throws SAXException { 39 reset(); 40 } 41 42 public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { 43 fElementList.addFirst(qName); 46 } 47 48 public void endElement(String uri, String localName, String qName) throws SAXException { 49 if (fElementList.size() != 0) { 51 fElementList.removeFirst(); 52 } else { 53 throw new SAXException ("Serious error. XML document is not well-formed"); } 56 } 57 58 public InputSource resolveEntity(String publicId, String systemId) throws SAXException { 59 return new InputSource (new StringReader ("")); } 64 65 } 66 | Popular Tags |