| 1 | #ifndef DOMCDataSection_HEADER_GUARD_ |
|---|
| 2 | #define DOMCDataSection_HEADER_GUARD_ |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | /* |
|---|
| 6 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|---|
| 7 | * contributor license agreements. See the NOTICE file distributed with |
|---|
| 8 | * this work for additional information regarding copyright ownership. |
|---|
| 9 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|---|
| 10 | * (the "License"); you may not use this file except in compliance with |
|---|
| 11 | * the License. You may obtain a copy of the License at |
|---|
| 12 | * |
|---|
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 14 | * |
|---|
| 15 | * Unless required by applicable law or agreed to in writing, software |
|---|
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|---|
| 18 | * See the License for the specific language governing permissions and |
|---|
| 19 | * limitations under the License. |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | /* |
|---|
| 23 | * $Id: DOMCDATASection.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|---|
| 24 | */ |
|---|
| 25 | |
|---|
| 26 | #include <xercesc/util/XercesDefs.hpp> |
|---|
| 27 | #include <xercesc/dom/DOMText.hpp> |
|---|
| 28 | |
|---|
| 29 | XERCES_CPP_NAMESPACE_BEGIN |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | /** |
|---|
| 33 | * CDATA sections are used to escape blocks of text containing characters that |
|---|
| 34 | * would otherwise be regarded as markup. The only delimiter that is |
|---|
| 35 | * recognized in a CDATA section is the "]]>" string that ends the CDATA |
|---|
| 36 | * section. CDATA sections cannot be nested. Their primary purpose is for |
|---|
| 37 | * including material such as XML fragments, without needing to escape all |
|---|
| 38 | * the delimiters. |
|---|
| 39 | * <p>The <code>data</code> attribute of the <code>DOMText</code> node holds |
|---|
| 40 | * the text that is contained by the CDATA section. Note that this may |
|---|
| 41 | * contain characters that need to be escaped outside of CDATA sections and |
|---|
| 42 | * that, depending on the character encoding ("charset") chosen for |
|---|
| 43 | * serialization, it may be impossible to write out some characters as part |
|---|
| 44 | * of a CDATA section. |
|---|
| 45 | * <p>The <code>DOMCDATASection</code> interface inherits from the |
|---|
| 46 | * <code>DOMCharacterData</code> interface through the <code>DOMText</code> |
|---|
| 47 | * interface. Adjacent <code>DOMCDATASection</code> nodes are not merged by use |
|---|
| 48 | * of the <code>normalize</code> method of the <code>DOMNode</code> interface. |
|---|
| 49 | * Because no markup is recognized within a <code>DOMCDATASection</code>, |
|---|
| 50 | * character numeric references cannot be used as an escape mechanism when |
|---|
| 51 | * serializing. Therefore, action needs to be taken when serializing a |
|---|
| 52 | * <code>DOMCDATASection</code> with a character encoding where some of the |
|---|
| 53 | * contained characters cannot be represented. Failure to do so would not |
|---|
| 54 | * produce well-formed XML.One potential solution in the serialization |
|---|
| 55 | * process is to end the CDATA section before the character, output the |
|---|
| 56 | * character using a character reference or entity reference, and open a new |
|---|
| 57 | * CDATA section for any further characters in the text node. Note, however, |
|---|
| 58 | * that some code conversion libraries at the time of writing do not return |
|---|
| 59 | * an error or exception when a character is missing from the encoding, |
|---|
| 60 | * making the task of ensuring that data is not corrupted on serialization |
|---|
| 61 | * more difficult. |
|---|
| 62 | * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>. |
|---|
| 63 | * |
|---|
| 64 | * @since DOM Level 1 |
|---|
| 65 | */ |
|---|
| 66 | class CDOM_EXPORT DOMCDATASection: public DOMText { |
|---|
| 67 | protected: |
|---|
| 68 | // ----------------------------------------------------------------------- |
|---|
| 69 | // Hidden constructors |
|---|
| 70 | // ----------------------------------------------------------------------- |
|---|
| 71 | /** @name Hidden constructors */ |
|---|
| 72 | //@{ |
|---|
| 73 | DOMCDATASection() {} |
|---|
| 74 | DOMCDATASection(const DOMCDATASection &other) : DOMText(other) {} |
|---|
| 75 | //@} |
|---|
| 76 | |
|---|
| 77 | private: |
|---|
| 78 | // ----------------------------------------------------------------------- |
|---|
| 79 | // Unimplemented constructors and operators |
|---|
| 80 | // ----------------------------------------------------------------------- |
|---|
| 81 | /** @name Unimplemented operators */ |
|---|
| 82 | //@{ |
|---|
| 83 | DOMCDATASection & operator = (const DOMCDATASection &); |
|---|
| 84 | //@} |
|---|
| 85 | |
|---|
| 86 | public: |
|---|
| 87 | // ----------------------------------------------------------------------- |
|---|
| 88 | // All constructors are hidden, just the destructor is available |
|---|
| 89 | // ----------------------------------------------------------------------- |
|---|
| 90 | /** @name Destructor */ |
|---|
| 91 | //@{ |
|---|
| 92 | /** |
|---|
| 93 | * Destructor |
|---|
| 94 | * |
|---|
| 95 | */ |
|---|
| 96 | virtual ~DOMCDATASection() {}; |
|---|
| 97 | //@} |
|---|
| 98 | |
|---|
| 99 | }; |
|---|
| 100 | |
|---|
| 101 | XERCES_CPP_NAMESPACE_END |
|---|
| 102 | |
|---|
| 103 | #endif |
|---|
| 104 | |
|---|