01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.xml.impl;
17:
18: import javax.xml.namespace.QName;
19:
20: import org.eclipse.xsd.XSDElementDeclaration;
21: import org.xml.sax.Attributes;
22: import org.xml.sax.SAXException;
23:
24: /**
25: * Classes implementing this interface serve has handlers for elements in an
26: * instance document as it is parsed. The element handler interface is a subset of the {@link
27: * org.xml.sax.ContentHandler} interface.
28: *
29: * <p>The methods <code>startElement, characters, and endElement</code> are called in
30: * sequence as they are for normal sax content handlers.
31: * </p>
32: *
33: * <p>
34: * An element handler corresponds to a specific element in a schema. A handler
35: * must return a child handler for each valid child element of its corresponding
36: * element.
37: * </p>
38: *
39: * @see org.xml.sax.ContentHandler
40: *
41: * @author Justin Deoliveira,Refractions Research Inc.,jdeolive@refractions.net
42: *
43: */
44: public interface ElementHandler extends Handler {
45: /**
46: * Callback on leading edge of an element.
47: *
48: * @param qName The qualified name of the element being handled.
49: * @param attributes The attributes of hte elmenent being handled.
50: *
51: * @throws SAXException Any xml errors that occur.
52: *
53: * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
54: */
55: void startElement(QName qName, Attributes attributes)
56: throws SAXException;
57:
58: /**
59: * Callback when characters of an element are encountered.
60: *
61: * @param ch Array containing characters.
62: * @param start The starting index of the characters.
63: * @param length The number of characters.
64: *
65: * @throws SAXException Any xml errors.
66: *
67: * @see org.xml.sax.ContentHandler#characters(char[], int, int)
68: */
69: void characters(char[] ch, int start, int length)
70: throws SAXException;
71:
72: /**
73: * Callback on trailing edge of element.
74: *
75: * @param qName The qualified name of the element being handled.
76: *
77: * @throws SAXException Any xml errors.
78: *
79: * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
80: */
81: void endElement(QName qName) throws SAXException;
82:
83: /**
84: * @return The declaration of hte element being handled.
85: */
86: XSDElementDeclaration getElementDeclaration();
87: }
|