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: * AnyAttributeHandler purpose.
023: *
024: * <p>
025: * Represents an 'anyAttribute' element in an xml schema
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/AnyAttributeHandler.java $
031: * @version $Id: AnyAttributeHandler.java 22266 2006-10-19 11:30:55Z acuster $
032: */
033: public class AnyAttributeHandler extends XSIElementHandler {
034: /** 'anyAttribute' */
035: public final static String LOCALNAME = "anyAttribute";
036:
037: // private String id;
038: private String namespace;
039:
040: // private int processContents;
041:
042: /**
043: * @see Object#hashCode()
044: */
045: public int hashCode() {
046: return LOCALNAME.hashCode()
047: * ((namespace == null) ? 1 : namespace.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:
066: namespace = atts.getValue("", "namespace");
067:
068: if (namespace == null) {
069: namespace = atts.getValue(namespaceURI, "namespace");
070: }
071: }
072:
073: /**
074: * @see org.geotools.xml.XSIElementHandler#getLocalName()
075: */
076: public String getLocalName() {
077: return LOCALNAME;
078: }
079:
080: /**
081: * Returns the values of the namespace attribute
082: *
083: */
084: public String getNamespace() {
085: return namespace;
086: }
087:
088: /**
089: * @see org.geotools.xml.XSIElementHandler#getHandlerType()
090: */
091: public int getHandlerType() {
092: return DEFAULT;
093: }
094:
095: /**
096: * @see org.geotools.xml.XSIElementHandler#endElement(java.lang.String,
097: * java.lang.String)
098: */
099: public void endElement(String namespaceURI, String localName) {
100: // do nothing
101: }
102: }
|