1 31 32 package org.opencms.xml.types; 33 34 import org.opencms.file.CmsObject; 35 import org.opencms.main.CmsIllegalArgumentException; 36 import org.opencms.main.CmsRuntimeException; 37 import org.opencms.util.CmsStringUtil; 38 import org.opencms.xml.I_CmsXmlDocument; 39 40 import java.util.Locale ; 41 42 import org.dom4j.Element; 43 44 53 public abstract class A_CmsXmlValueCdataBase extends A_CmsXmlContentValue { 54 55 56 protected String m_stringValue; 57 58 62 protected A_CmsXmlValueCdataBase() { 63 64 super(); 65 } 66 67 75 protected A_CmsXmlValueCdataBase(I_CmsXmlDocument document, Element element, Locale locale, I_CmsXmlSchemaType type) { 76 77 super(document, element, locale, type); 78 m_stringValue = element.getText(); 79 } 80 81 88 protected A_CmsXmlValueCdataBase(String name, String minOccurs, String maxOccurs) { 89 90 super(name, minOccurs, maxOccurs); 91 } 92 93 96 public String getPlainText(CmsObject cms) { 97 98 return getStringValue(cms); 99 } 100 101 104 public String getStringValue(CmsObject cms) throws CmsRuntimeException { 105 106 return m_stringValue; 107 } 108 109 112 public void setStringValue(CmsObject cms, String value) throws CmsIllegalArgumentException { 113 114 m_element.clearContent(); 115 if (CmsStringUtil.isNotEmpty(value)) { 116 m_element.addCDATA(value); 117 } 118 m_stringValue = value; 119 } 120 } | Popular Tags |