View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 1999-2002,2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package com.sun.org.apache.xerces.internal.dom;
22  
23  import org.w3c.dom.CDATASection;
24  import org.w3c.dom.Node;
25  
26  /**
27   * XML provides the CDATA markup to allow a region of text in which
28   * most of the XML delimiter recognition does not take place. This is
29   * intended to ease the task of quoting XML fragments and other
30   * programmatic information in a document's text without needing to
31   * escape these special characters. It's primarily a convenience feature
32   * for those who are hand-editing XML.
33   * <P>
34   * CDATASection is an Extended DOM feature, and is not used in HTML
35   * contexts.
36   * <P>
37   * Within the DOM, CDATASections are treated essentially as Text
38   * blocks. Their distinct type is retained in order to allow us to
39   * properly recreate the XML syntax when we write them out.
40   * <P>
41   * Reminder: CDATA IS NOT A COMPLETELY GENERAL SOLUTION; it can't
42   * quote its own end-of-block marking. If you need to write out a
43   * CDATA that contains the ]]> sequence, it's your responsibility to
44   * split that string over two successive CDATAs at that time.
45   * <P>
46   * CDATA does not participate in Element.normalize() processing.
47   *
48   * @xerces.internal
49   *
50   * @since  PR-DOM-Level-1-19980818.
51   */
52  public class CDATASectionImpl
53      extends TextImpl
54      implements CDATASection {
55  
56      //
57      // Constants
58      //
59  
60      /** Serialization version. */
61      static final long serialVersionUID = 2372071297878177780L;
62  
63      //
64      // Constructors
65      //
66  
67      /** Factory constructor for creating a CDATA section. */
68      public CDATASectionImpl(CoreDocumentImpl ownerDoc, String data) {
69          super(ownerDoc, data);
70      }
71  
72      //
73      // Node methods
74      //
75  
76      /**
77       * A short integer indicating what type of node this is. The named
78       * constants for this value are defined in the org.w3c.dom.Node interface.
79       */
80      public short getNodeType() {
81          return Node.CDATA_SECTION_NODE;
82      }
83  
84      /** Returns the node name. */
85      public String getNodeName() {
86          return "#cdata-section";
87      }
88  
89  } // class CDATASectionImpl