001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software GmbH & Co. KG, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.xml.types; 029 030import org.opencms.xml.I_CmsXmlDocument; 031 032import java.util.Locale; 033 034import org.dom4j.Element; 035 036/** 037 * Describes the XML content type "OpenCmsString".<p> 038 * 039 * @since 6.0.0 040 */ 041public class CmsXmlStringValue extends A_CmsXmlValueCdataBase { 042 043 /** The name of this type as used in the XML schema. */ 044 public static final String TYPE_NAME = "OpenCmsString"; 045 046 /** 047 * Creates a new, empty schema type descriptor of type "OpenCmsString".<p> 048 */ 049 public CmsXmlStringValue() { 050 051 // empty constructor is required for class registration 052 } 053 054 /** 055 * Creates a new XML content value of type "OpenCmsString".<p> 056 * 057 * @param document the XML content instance this value belongs to 058 * @param element the XML element that contains this value 059 * @param locale the locale this value is created for 060 * @param type the type instance to create the value for 061 */ 062 public CmsXmlStringValue(I_CmsXmlDocument document, Element element, Locale locale, I_CmsXmlSchemaType type) { 063 064 super(document, element, locale, type); 065 } 066 067 /** 068 * Creates a new schema type descriptor for the type "OpenCmsString".<p> 069 * 070 * @param name the name of the XML node containing the value according to the XML schema 071 * @param minOccurs minimum number of occurrences of this type according to the XML schema 072 * @param maxOccurs maximum number of occurrences of this type according to the XML schema 073 */ 074 public CmsXmlStringValue(String name, String minOccurs, String maxOccurs) { 075 076 super(name, minOccurs, maxOccurs); 077 } 078 079 /** 080 * @see org.opencms.xml.types.A_CmsXmlContentValue#createValue(I_CmsXmlDocument, org.dom4j.Element, Locale) 081 */ 082 public I_CmsXmlContentValue createValue(I_CmsXmlDocument document, Element element, Locale locale) { 083 084 return new CmsXmlStringValue(document, element, locale, this); 085 } 086 087 /** 088 * @see org.opencms.xml.types.I_CmsXmlSchemaType#getSchemaDefinition() 089 */ 090 public String getSchemaDefinition() { 091 092 return "<xsd:simpleType name=\"" + TYPE_NAME + "\"><xsd:restriction base=\"xsd:string\" /></xsd:simpleType>"; 093 } 094 095 /** 096 * @see org.opencms.xml.types.A_CmsXmlContentValue#getTypeName() 097 */ 098 public String getTypeName() { 099 100 return TYPE_NAME; 101 } 102 103 /** 104 * @see org.opencms.xml.types.A_CmsXmlContentValue#newInstance(java.lang.String, java.lang.String, java.lang.String) 105 */ 106 public I_CmsXmlSchemaType newInstance(String name, String minOccurs, String maxOccurs) { 107 108 return new CmsXmlStringValue(name, minOccurs, maxOccurs); 109 } 110}