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