001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.xml.handlers.xsi;
017:
018: import org.geotools.xml.XSIElementHandler;
019: import org.xml.sax.Attributes;
020:
021: /**
022: * FieldHandler purpose.
023: *
024: * <p>
025: * Represents a 'field' element. This class is not currently in use as key ...
026: * constraints are not used.
027: * </p>
028: * TODO Use the referential constraints ... thus using this class
029: *
030: * @author dzwiers, Refractions Research, Inc. http://www.refractions.net
031: * @author $Author:$ (last modification)
032: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/main/java/org/geotools/xml/handlers/xsi/FieldHandler.java $
033: * @version $Id: FieldHandler.java 22266 2006-10-19 11:30:55Z acuster $
034: */
035: public class FieldHandler extends XSIElementHandler {
036: /** 'field' */
037: public final static String LOCALNAME = "field";
038: private String id;
039: private String xpath;
040:
041: /**
042: * @see java.lang.Object#hashCode()
043: */
044: public int hashCode() {
045: return LOCALNAME.hashCode()
046: * ((id == null) ? 1 : id.hashCode())
047: * ((xpath == null) ? 1 : xpath.hashCode());
048: }
049:
050: /**
051: * @see org.geotools.xml.XSIElementHandler#getHandler(java.lang.String,
052: * java.lang.String)
053: */
054: public XSIElementHandler getHandler(String namespaceURI,
055: String localName) {
056: return null;
057: }
058:
059: /**
060: * @see org.geotools.xml.XSIElementHandler#startElement(java.lang.String,
061: * java.lang.String, org.xml.sax.Attributes)
062: */
063: public void startElement(String namespaceURI, String localName,
064: Attributes atts) {
065: id = atts.getValue("", "id");
066:
067: if (id == null) {
068: id = atts.getValue(namespaceURI, "id");
069: }
070:
071: xpath = atts.getValue("", "xpath");
072:
073: if (xpath == null) {
074: xpath = atts.getValue(namespaceURI, "xpath");
075: }
076: }
077:
078: /**
079: * @see org.geotools.xml.XSIElementHandler#getLocalName()
080: */
081: public String getLocalName() {
082: return LOCALNAME;
083: }
084:
085: /**
086: * <p>
087: * The ID
088: * </p>
089: * TODO Is this method required?
090: *
091: */
092: public String getId() {
093: return id;
094: }
095:
096: /**
097: * <p>
098: * The Xpath
099: * </p>
100: * TODO Is this method required?
101: *
102: */
103: public String getXpath() {
104: return xpath;
105: }
106:
107: /**
108: * @see org.geotools.xml.XSIElementHandler#getHandlerType()
109: */
110: public int getHandlerType() {
111: return DEFAULT;
112: }
113:
114: /**
115: * @see org.geotools.xml.XSIElementHandler#endElement(java.lang.String,
116: * java.lang.String)
117: */
118: public void endElement(String namespaceURI, String localName) {
119: // do nothing
120: }
121: }
|