001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: * Free SoftwareFoundation, Inc.
023: * 59 Temple Place, Suite 330
024: * Boston, MA 02111-1307 USA
025: *
026: * @author Scott Ferguson
027: */
028:
029: package com.caucho.xml;
030:
031: import org.w3c.dom.Node;
032: import org.w3c.dom.Notation;
033:
034: import java.io.IOException;
035:
036: class QNotation extends QNode implements Notation {
037: String _name;
038: String _publicId;
039: String _systemId;
040:
041: QNotation(String name, String publicId, String systemId) {
042: _name = name;
043: _publicId = publicId;
044: _systemId = systemId;
045: }
046:
047: public String getNodeName() {
048: return _name;
049: }
050:
051: public String getTagName() {
052: return _name;
053: }
054:
055: public short getNodeType() {
056: return Node.NOTATION_NODE;
057: }
058:
059: public String getPublicId() {
060: return _publicId;
061: }
062:
063: public void setPublicId(String arg) {
064: _publicId = arg;
065: }
066:
067: public String getSystemId() {
068: return _systemId;
069: }
070:
071: public void setSystemId(String arg) {
072: _systemId = arg;
073: }
074:
075: Node importNode(QDocument owner, boolean deep) {
076: QNotation notation = new QNotation(_name, _publicId, _systemId);
077:
078: return notation;
079: }
080:
081: public void print(XmlPrinter os) throws IOException {
082: os.print("<!NOTATION ");
083: os.print(_name);
084: if (_publicId != null) {
085: os.print(" PUBLIC \"");
086: os.print(_publicId);
087: os.print("\"");
088: if (_systemId != null) {
089: os.print(" \"");
090: os.print(_systemId);
091: os.print("\"");
092: }
093: } else if (_systemId != null) {
094: os.print(" SYSTEM \"");
095: os.print(_systemId);
096: os.print("\"");
097: }
098: os.println(">");
099: }
100: }
|