001: /*
002: * $Id: DTDEvent.java,v 1.2 2004/07/15 02:11:02 cniles Exp $
003: *
004: * Copyright (c) 2004, Christian Niles, unit12.net
005: * All rights reserved.
006: *
007: * Redistribution and use in source and binary forms, with or without
008: * modification, are permitted provided that the following conditions are met:
009: *
010: * * Redistributions of source code must retain the above copyright
011: * notice, this list of conditions and the following disclaimer.
012: *
013: * * Redistributions in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in the
015: * documentation and/or other materials provided with the distribution.
016: *
017: * * Neither the name of Christian Niles, Unit12, nor the names of its
018: * contributors may be used to endorse or promote products derived from
019: * this software without specific prior written permission.
020: *
021: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
022: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
023: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
024: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
025: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
026: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
027: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
028: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
029: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
030: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
031: * POSSIBILITY OF SUCH DAMAGE.
032: *
033: */
034: package javanet.staxutils.events;
035:
036: import java.util.Collections;
037: import java.util.List;
038:
039: import javax.xml.stream.Location;
040: import javax.xml.stream.events.DTD;
041:
042: /**
043: * <code>DTD</code> event implementation.
044: *
045: * @author Christian Niles
046: * @version $Revision: 1.2 $
047: */
048: public class DTDEvent extends AbstractXMLEvent implements DTD {
049:
050: /**
051: * The full DTD declaration.
052: */
053: protected String declaration;
054:
055: /**
056: * The list of {@link javax.xml.stream.events.EntityDeclaration}s.
057: */
058: protected List entities;
059:
060: /**
061: * The list of {@link javax.xml.stream.events.NotationDeclaration}s.
062: */
063: protected List notations;
064:
065: public DTDEvent(String declaration, Location location) {
066:
067: super (location);
068: this .declaration = declaration;
069: // TODO Parse declaration?
070:
071: }
072:
073: public DTDEvent(String declaration, List entities, List notations,
074: Location location) {
075:
076: super (location);
077: this .declaration = declaration;
078: this .entities = (entities == null ? Collections.EMPTY_LIST
079: : entities);
080: this .notations = (notations == null ? Collections.EMPTY_LIST
081: : notations);
082:
083: }
084:
085: /** Copy constructor. */
086: public DTDEvent(DTD that) {
087:
088: super (that);
089: this .declaration = that.getDocumentTypeDeclaration();
090: this .entities = that.getEntities();
091: this .notations = that.getNotations();
092:
093: }
094:
095: /**
096: * Returns {@link #DTD}.
097: */
098: public int getEventType() {
099:
100: return DTD;
101:
102: }
103:
104: public String getDocumentTypeDeclaration() {
105:
106: return declaration;
107:
108: }
109:
110: public List getEntities() {
111:
112: return entities;
113:
114: }
115:
116: public List getNotations() {
117:
118: return notations;
119:
120: }
121:
122: public Object getProcessedDTD() {
123:
124: return null;
125:
126: }
127:
128: }
|