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: * SelectorHandler purpose.
023: *
024: * <p>
025: * Represents a selector element
026: * </p>
027: *
028: * @author dzwiers, Refractions Research, Inc. http://www.refractions.net
029: * @author $Author:$ (last modification)
030: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/main/java/org/geotools/xml/handlers/xsi/SelectorHandler.java $
031: * @version $Id: SelectorHandler.java 20703 2006-07-24 16:57:44Z jgarnett $
032: */
033: public class SelectorHandler extends XSIElementHandler {
034: /** 'selector' */
035: public final static String LOCALNAME = "selector";
036: private String id;
037: private String xpath;
038:
039: /**
040: * @see java.lang.Object#hashCode()
041: */
042: public int hashCode() {
043: return LOCALNAME.hashCode()
044: * ((id == null) ? 1 : id.hashCode())
045: * ((xpath == null) ? 1 : xpath.hashCode());
046: }
047:
048: /**
049: * @see org.geotools.xml.XSIElementHandler#getHandler(java.lang.String,
050: * java.lang.String)
051: */
052: public XSIElementHandler getHandler(String namespaceURI,
053: String localName) {
054: return null;
055: }
056:
057: /**
058: * @see org.geotools.xml.XSIElementHandler#startElement(java.lang.String,
059: * java.lang.String, org.xml.sax.Attributes)
060: */
061: public void startElement(String namespaceURI, String localName,
062: Attributes atts) {
063: id = atts.getValue("", "id");
064:
065: if (id == null) {
066: id = atts.getValue(namespaceURI, "id");
067: }
068:
069: // xpath
070: xpath = atts.getValue("", "xpath");
071:
072: if (xpath == null) {
073: xpath = atts.getValue(namespaceURI, "xpath");
074: }
075: }
076:
077: /**
078: * @see org.geotools.xml.XSIElementHandler#getLocalName()
079: */
080: public String getLocalName() {
081: return LOCALNAME;
082: }
083:
084: /**
085: * DOCUMENT ME!
086: *
087: * @return id attribute value
088: */
089: public String getId() {
090: return id;
091: }
092:
093: /**
094: * DOCUMENT ME!
095: *
096: * @return xPath attribute value
097: */
098: public String getXpath() {
099: return xpath;
100: }
101:
102: /**
103: * @see org.geotools.xml.XSIElementHandler#getHandlerType()
104: */
105: public int getHandlerType() {
106: return DEFAULT;
107: }
108:
109: /**
110: * @see org.geotools.xml.XSIElementHandler#endElement(java.lang.String,
111: * java.lang.String)
112: */
113: public void endElement(String namespaceURI, String localName) {
114: // do nothing
115: }
116: }
|