Source Code Cross Referenced for CDATA.java in  » Workflow-Engines » OpenWFE » org » jdom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » OpenWFE » org.jdom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*--
002:
003:         $Id: CDATA.java,v 1.1 2005/04/27 09:32:39 wittek Exp $
004:
005:         Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
006:         All rights reserved.
007:
008:         Redistribution and use in source and binary forms, with or without
009:         modification, are permitted provided that the following conditions
010:         are met:
011:
012:         1. Redistributions of source code must retain the above copyright
013:            notice, this list of conditions, and the following disclaimer.
014:
015:         2. Redistributions in binary form must reproduce the above copyright
016:            notice, this list of conditions, and the disclaimer that follows
017:            these conditions in the documentation and/or other materials
018:            provided with the distribution.
019:
020:         3. The name "JDOM" must not be used to endorse or promote products
021:            derived from this software without prior written permission.  For
022:            written permission, please contact <request_AT_jdom_DOT_org>.
023:
024:         4. Products derived from this software may not be called "JDOM", nor
025:            may "JDOM" appear in their name, without prior written permission
026:            from the JDOM Project Management <request_AT_jdom_DOT_org>.
027:
028:         In addition, we request (but do not require) that you include in the
029:         end-user documentation provided with the redistribution and/or in the
030:         software itself an acknowledgement equivalent to the following:
031:             "This product includes software developed by the
032:              JDOM Project (http://www.jdom.org/)."
033:         Alternatively, the acknowledgment may be graphical using the logos
034:         available at http://www.jdom.org/images/logos.
035:
036:         THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037:         WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039:         DISCLAIMED.  IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
040:         CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041:         SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042:         LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043:         USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044:         ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045:         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046:         OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047:         SUCH DAMAGE.
048:
049:         This software consists of voluntary contributions made by many
050:         individuals on behalf of the JDOM Project and was originally
051:         created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
052:         Brett McLaughlin <brett_AT_jdom_DOT_org>.  For more information
053:         on the JDOM Project, please see <http://www.jdom.org/>.
054:
055:         */
056:
057:        package org.jdom;
058:
059:        /**
060:         * An XML CDATA section. Represents character-based content within an XML
061:         * document that should be output within special CDATA tags. Semantically it's
062:         * identical to a simple {@link Text} object, but output behavior is different.
063:         * CDATA makes no guarantees about the underlying textual representation of
064:         * character data, but does expose that data as a Java String.
065:         *
066:         * @version $Revision: 1.1 $, $Date: 2005/04/27 09:32:39 $
067:         * @author  Dan Schaffer
068:         * @author  Brett McLaughlin
069:         * @author  Jason Hunter
070:         * @author  Bradley S. Huffman
071:         */
072:        public class CDATA extends Text {
073:
074:            private static final String CVS_ID = "@(#) $RCSfile: CDATA.java,v $ $Revision: 1.1 $ $Date: 2005/04/27 09:32:39 $ $Name:  $";
075:
076:            /**
077:             * This is the protected, no-args constructor standard in all JDOM
078:             * classes. It allows subclassers to get a raw instance with no
079:             * initialization.
080:             */
081:            protected CDATA() {
082:            }
083:
084:            /**
085:             * This constructor creates a new <code>CDATA</code> node, with the
086:             * supplied string value as it's character content.
087:             *
088:             * @param str the node's character content.
089:             * @throws IllegalDataException if <code>str</code> contains an 
090:             *         illegal character such as a vertical tab (as determined
091:             *          by {@link org.jdom.Verifier#checkCharacterData})
092:             *         or the CDATA end delimiter <code>]]&gt;</code>.
093:             */
094:            public CDATA(String str) {
095:                setText(str);
096:            }
097:
098:            /**
099:             * This will set the value of this <code>CDATA</code> node.
100:             *
101:             * @param str value for node's content.
102:             * @return the object on which the method was invoked
103:             * @throws IllegalDataException if <code>str</code> contains an 
104:             *         illegal character such as a vertical tab (as determined
105:             *          by {@link org.jdom.Verifier#checkCharacterData})
106:             *         or the CDATA end delimiter <code>]]&gt;</code>.
107:             */
108:            public Text setText(String str) {
109:                // Overrides Text.setText() because this needs to check CDATA
110:                // rules are enforced.  We could have a separate Verifier check
111:                // for CDATA beyond Text and call that alone before super.setText().
112:
113:                String reason;
114:
115:                if (str == null) {
116:                    value = EMPTY_STRING;
117:                    return this ;
118:                }
119:
120:                if ((reason = Verifier.checkCDATASection(str)) != null) {
121:                    throw new IllegalDataException(str, "CDATA section", reason);
122:                }
123:                value = str;
124:                return this ;
125:            }
126:
127:            /**
128:             * This will append character content to whatever content already
129:             * exists within this <code>CDATA</code> node.
130:             *
131:             * @param str character content to append.
132:             * @throws IllegalDataException if <code>str</code> contains an 
133:             *         illegal character such as a vertical tab (as determined
134:             *          by {@link org.jdom.Verifier#checkCharacterData})
135:             *         or the CDATA end delimiter <code>]]&gt;</code>.
136:             */
137:            public void append(String str) {
138:                // Overrides Text.setText() because this needs to check CDATA
139:                // rules are enforced.  We could have a separate Verifier check
140:                // for CDATA beyond Text and call that alone before super.setText().
141:
142:                String reason;
143:
144:                if (str == null) {
145:                    return;
146:                }
147:                if ((reason = Verifier.checkCDATASection(str)) != null) {
148:                    throw new IllegalDataException(str, "CDATA section", reason);
149:                }
150:
151:                if (value == EMPTY_STRING)
152:                    value = str;
153:                else
154:                    value += str;
155:            }
156:
157:            /**
158:             * This returns a <code>String</code> representation of the
159:             * <code>CDATA</code> node, suitable for debugging. If the XML
160:             * representation of the <code>CDATA</code> node is desired,
161:             * either <code>{@link #getText}</code> or
162:             * {@link org.jdom.output.XMLOutputter#output(CDATA, java.io.Writer)}</code>
163:             * should be used.
164:             *
165:             * @return <code>String</code> - information about this node.
166:             */
167:            public String toString() {
168:                return new StringBuffer(64).append("[CDATA: ")
169:                        .append(getText()).append("]").toString();
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.