KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > dom > CDATASectionImpl


1 /**
2  * org/ozone-db/xml/dom/CDATASectionImpl.java
3  *
4  * The contents of this file are subject to the OpenXML Public
5  * License Version 1.0; you may not use this file except in compliance
6  * with the License. You may obtain a copy of the License at
7  * http://www.openxml.org/license.html
8  *
9  * THIS SOFTWARE IS DISTRIBUTED ON AN "AS IS" BASIS WITHOUT WARRANTY
10  * OF ANY KIND, EITHER EXPRESSED OR IMPLIED. THE INITIAL DEVELOPER
11  * AND ALL CONTRIBUTORS SHALL NOT BE LIABLE FOR ANY DAMAGES AS A
12  * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
13  * DERIVATIVES. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
14  * RIGHTS AND LIMITATIONS UNDER THE LICENSE.
15  *
16  * The Initial Developer of this code under the License is Assaf Arkin.
17  * Portions created by Assaf Arkin are Copyright (C) 1998, 1999.
18  * All Rights Reserved.
19  */

20
21 /**
22  * Changes for Persistent DOM running with ozone are
23  * Copyright 1999 by SMB GmbH. All rights reserved.
24  */

25
26
27 package org.ozoneDB.xml.dom;
28
29 import org.w3c.dom.*;
30
31
32 /**
33  * CDATA sections are used to escape blocks of text containing characters that
34  * would otherwise be regarded as markup. It is fully implemented by the {@link
35  * org.w3c.dom.Text} node type.
36  * <P>
37  * Notes:
38  * <OL>
39  * <LI>Node type is {@link org.w3c.dom.Node#COMMENT_NODE}
40  * <LI>Node does not support childern
41  * <LI>Node name is always "#comment"
42  * </OL>
43  *
44  *
45  * @version $Revision: 1.2 $ $Date: 2003/11/20 23:18:42 $
46  * @author <a HREF="mailto:arkin@trendline.co.il">Assaf Arkin</a>
47  * @see org.w3c.dom.CDATASection
48  * @see TextImpl
49  */

50 public final class CDATASectionImpl extends TextImpl implements CDATASectionProxy {
51
52     final static long serialVersionUID = 1;
53
54
55     /**
56      */

57     public short getNodeType() {
58         return this.CDATA_SECTION_NODE;
59     }
60
61
62     /**
63      */

64     public final Object JavaDoc clone() {
65         CDATASectionProxy clone = null;
66         try {
67             clone = (CDATASectionProxy)database().createObject( CDATASectionImpl.class.getName() );
68             clone.init( _ownerDocument, getNodeValue() );
69             cloneInto( clone, true );
70         } catch (Exception JavaDoc except) {
71             throw new DOMExceptionImpl( DOMExceptionImpl.PDOM_ERR, except.getMessage() );
72         }
73         return clone;
74     }
75
76
77     /**
78      */

79     public final Node cloneNode( boolean deep ) {
80         CDATASectionProxy clone = null;
81         try {
82             clone = (CDATASectionProxy)database().createObject( CDATASectionImpl.class.getName() );
83             clone.init( _ownerDocument, getNodeValue() );
84             cloneInto( clone, deep );
85         } catch (Exception JavaDoc except) {
86             throw new DOMExceptionImpl( DOMExceptionImpl.PDOM_ERR, except.getMessage() );
87         }
88         return clone;
89     }
90
91
92     /**
93      */

94     public String JavaDoc toString() {
95         String JavaDoc value;
96
97         value = getData();
98         if (value.length() > 64) {
99             value = value.substring( 0, 64 ) + "..";
100         }
101         value = value.replace( '\n', '|' );
102         return "CDATA node: [" + value + "]";
103     }
104
105
106     /**
107      * Hidden constructor.
108      *
109      * @param owner The owner of this document
110      * @param value Initial value or empty string
111      */

112     CDATASectionImpl( DocumentImpl owner, String JavaDoc value ) {
113         super( owner, "#cdata-section", value );
114     }
115
116
117     /**
118      */

119     public CDATASectionImpl() {
120         super();
121     }
122
123
124     /**
125      */

126     public final void init( DocumentProxy owner, String JavaDoc value ) {
127         super.init( owner, "#cdata-section", value );
128     }
129
130 }
131
Popular Tags