001: /**
002: * Redistribution and use of this software and associated documentation
003: * ("Software"), with or without modification, are permitted provided
004: * that the following conditions are met:
005: *
006: * 1. Redistributions of source code must retain copyright
007: * statements and notices. Redistributions must also contain a
008: * copy of this document.
009: *
010: * 2. Redistributions in binary form must reproduce the
011: * above copyright notice, this list of conditions and the
012: * following disclaimer in the documentation and/or other
013: * materials provided with the distribution.
014: *
015: * 3. The name "Exolab" must not be used to endorse or promote
016: * products derived from this Software without prior written
017: * permission of Intalio, Inc. For written permission,
018: * please contact info@exolab.org.
019: *
020: * 4. Products derived from this Software may not be called "Exolab"
021: * nor may "Exolab" appear in their names without prior written
022: * permission of Intalio, Inc. Exolab is a registered
023: * trademark of Intalio, Inc.
024: *
025: * 5. Due credit should be given to the Exolab Project
026: * (http://www.exolab.org/).
027: *
028: * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS
029: * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
030: * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
031: * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
032: * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
033: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
034: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
035: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
036: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
037: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
038: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
039: * OF THE POSSIBILITY OF SUCH DAMAGE.
040: *
041: * Copyright 1999-2002 (C) Intalio, Inc. All Rights Reserved.
042: *
043: * $Id: UnknownUnmarshaller.java 5951 2006-05-30 22:18:48Z bsnyder $
044: */package org.exolab.castor.xml.schema.reader;
045:
046: //-- imported classes and packages
047: import org.exolab.castor.xml.AttributeSet;
048: import org.exolab.castor.xml.Namespaces;
049: import org.exolab.castor.xml.XMLException;
050:
051: /**
052: * A class for Skipping unknown elements during unmarshalling
053: * @author <a href="mailto:kvisco@intalio.com">Keith Visco</a>
054: * @version $Revision: 5951 $ $Date: 2005-12-13 14:58:48 -0700 (Tue, 13 Dec 2005) $
055: **/
056: public class UnknownUnmarshaller extends ComponentReader {
057:
058: //--------------------/
059: //- Member Variables -/
060: //--------------------/
061:
062: /**
063: * The name of the element we are "unmarshalling"
064: **/
065: String name;
066:
067: //----------------/
068: //- Constructors -/
069: //----------------/
070:
071: public UnknownUnmarshaller(String name) {
072: super ();
073: this .name = name;
074: } //-- UnknownUnmarshaller
075:
076: //-----------/
077: //- Methods -/
078: //-----------/
079:
080: /**
081: * Returns the name of the element that this ComponentReader
082: * handles
083: * @return the name of the element that this ComponentReader
084: * handles
085: **/
086: public String elementName() {
087: return name;
088: } //-- elementName
089:
090: /**
091: * Sets the name of the element that this UnknownUnmarshaller handles
092: * @param name the name of the element that this unmarshaller handles
093: **/
094: public void elementName(String name) {
095: this .name = name;
096: } //-- elementName
097:
098: /**
099: * Returns the Object created by this ComponentReader
100: * @return the Object created by this ComponentReader
101: **/
102: public Object getObject() {
103: return null;
104: } //-- getObject
105:
106: /**
107: * Signals the start of an element with the given name.
108: *
109: * @param name the NCName of the element. It is an error
110: * if the name is a QName (ie. contains a prefix).
111: * @param namespace the namespace of the element. This may be null.
112: * Note: A null namespace is not the same as the default namespace unless
113: * the default namespace is also null.
114: * @param atts the AttributeSet containing the attributes associated
115: * with the element.
116: * @param nsDecls the namespace declarations being declared for this
117: * element. This may be null.
118: **/
119: public void startElement(String name, String namespace,
120: AttributeSet atts, Namespaces nsDecls) throws XMLException {
121: //-- do nothing, this method is overwritten by subclasses
122:
123: } //-- startElement
124:
125: /**
126: * Signals to end of the element with the given name.
127: *
128: * @param name the NCName of the element. It is an error
129: * if the name is a QName (ie. contains a prefix).
130: * @param namespace the namespace of the element.
131: **/
132: public void endElement(String name, String namespace)
133: throws XMLException {
134: //-- do nothing, this method is overwritten by subclasses
135: } //-- endElement
136:
137: public void characters(char[] ch, int start, int length)
138: throws XMLException {
139: } //-- characters
140:
141: } //-- UnknownUnmarshaller
|