Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/com/sun/xml/internal/stream/events/NotationDeclarationImpl.java
86414 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.xml.internal.stream.events;2627import javax.xml.stream.events.NotationDeclaration;28import javax.xml.stream.events.XMLEvent;29import com.sun.xml.internal.stream.dtd.nonvalidating.XMLNotationDecl;3031/**32* Implementation of NotationDeclaration event.33*34* @author [email protected]35*/36public class NotationDeclarationImpl extends DummyEvent implements NotationDeclaration {3738String fName = null;39String fPublicId = null;40String fSystemId = null;4142/** Creates a new instance of NotationDeclarationImpl */43public NotationDeclarationImpl() {44setEventType(XMLEvent.NOTATION_DECLARATION);45}4647public NotationDeclarationImpl(String name,String publicId,String systemId){48this.fName = name;49this.fPublicId = publicId;50this.fSystemId = systemId;51setEventType(XMLEvent.NOTATION_DECLARATION);52}5354public NotationDeclarationImpl(XMLNotationDecl notation){55this.fName = notation.name;56this.fPublicId = notation.publicId;57this.fSystemId = notation.systemId;58setEventType(XMLEvent.NOTATION_DECLARATION);59}6061public String getName() {62return fName;63}6465public String getPublicId() {66return fPublicId;67}6869public String getSystemId() {70return fSystemId;71}7273void setPublicId(String publicId){74this.fPublicId = publicId;75}7677void setSystemId(String systemId){78this.fSystemId = systemId;79}8081void setName(String name){82this.fName = name;83}8485protected void writeAsEncodedUnicodeEx(java.io.Writer writer)86throws java.io.IOException87{88writer.write("<!NOTATION ");89writer.write(getName());90if (fPublicId != null) {91writer.write(" PUBLIC \"");92writer.write(fPublicId);93writer.write("\"");94} else if (fSystemId != null) {95writer.write(" SYSTEM");96writer.write(" \"");97writer.write(fSystemId);98writer.write("\"");99}100writer.write('>');101}102}103104105