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: * ImportHandler purpose.
023: *
024: * <p>
025: * Represents an 'include' 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/IncludeHandler.java $
031: * @version $Id: IncludeHandler.java 22266 2006-10-19 11:30:55Z acuster $
032: */
033: public class IncludeHandler extends XSIElementHandler {
034: /** 'include' */
035: public final static String LOCALNAME = "include";
036: private static int offset = 0;
037:
038: // private String id;
039: private String schemaLocation;
040: private int hashCodeOffset = getOffset();
041:
042: /*
043: * helper for hashCode()
044: */
045: private static int getOffset() {
046: return offset++;
047: }
048:
049: /**
050: * @see java.lang.Object#hashCode()
051: */
052: public int hashCode() {
053: return (LOCALNAME.hashCode() * ((schemaLocation == null) ? 1
054: : schemaLocation.hashCode()))
055: + hashCodeOffset;
056: }
057:
058: /**
059: * @see org.geotools.xml.XSIElementHandler#getHandler(java.lang.String,
060: * java.lang.String)
061: */
062: public XSIElementHandler getHandler(String namespaceURI,
063: String localName) {
064: return null;
065: }
066:
067: /**
068: * @see org.geotools.xml.XSIElementHandler#startElement(java.lang.String,
069: * java.lang.String, org.xml.sax.Attributes)
070: */
071: public void startElement(String namespaceURI, String localName,
072: Attributes atts) {
073: schemaLocation = atts.getValue("", "schemaLocation");
074:
075: if (schemaLocation == null) {
076: schemaLocation = atts.getValue(namespaceURI,
077: "schemaLocation");
078: }
079: }
080:
081: /**
082: * @see org.geotools.xml.XSIElementHandler#getLocalName()
083: */
084: public String getLocalName() {
085: return LOCALNAME;
086: }
087:
088: /**
089: * <p>
090: * returns the schemaLocation attribute
091: * </p>
092: *
093: */
094: public String getSchemaLocation() {
095: return schemaLocation;
096: }
097:
098: /**
099: * @see org.geotools.xml.XSIElementHandler#getHandlerType()
100: */
101: public int getHandlerType() {
102: return DEFAULT;
103: }
104:
105: /**
106: * @see org.geotools.xml.XSIElementHandler#endElement(java.lang.String,
107: * java.lang.String)
108: */
109: public void endElement(String namespaceURI, String localName) {
110: // do nothing
111: }
112: }
|