KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > xml > types > CmsXmlStringValue


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/xml/types/CmsXmlStringValue.java,v $
3  * Date : $Date: 2005/06/27 23:22:25 $
4  * Version: $Revision: 1.16 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.xml.types;
33
34 import org.opencms.xml.I_CmsXmlDocument;
35
36 import java.util.Locale JavaDoc;
37
38 import org.dom4j.Element;
39
40 /**
41  * Describes the XML content type "OpenCmsString".<p>
42  *
43  * @author Alexander Kandzior
44  *
45  * @version $Revision: 1.16 $
46  *
47  * @since 6.0.0
48  */

49 public class CmsXmlStringValue extends A_CmsXmlValueCdataBase {
50
51     /** The name of this type as used in the XML schema. */
52     public static final String JavaDoc TYPE_NAME = "OpenCmsString";
53
54     /**
55      * Creates a new, empty schema type descriptor of type "OpenCmsString".<p>
56      */

57     public CmsXmlStringValue() {
58
59         // empty constructor is required for class registration
60
}
61
62     /**
63      * Creates a new XML content value of type "OpenCmsString".<p>
64      *
65      * @param document the XML content instance this value belongs to
66      * @param element the XML element that contains this value
67      * @param locale the locale this value is created for
68      * @param type the type instance to create the value for
69      */

70     public CmsXmlStringValue(I_CmsXmlDocument document, Element element, Locale JavaDoc locale, I_CmsXmlSchemaType type) {
71
72         super(document, element, locale, type);
73     }
74
75     /**
76      * Creates a new schema type descriptor for the type "OpenCmsString".<p>
77      *
78      * @param name the name of the XML node containing the value according to the XML schema
79      * @param minOccurs minimum number of occurences of this type according to the XML schema
80      * @param maxOccurs maximum number of occurences of this type according to the XML schema
81      */

82     public CmsXmlStringValue(String JavaDoc name, String JavaDoc minOccurs, String JavaDoc maxOccurs) {
83
84         super(name, minOccurs, maxOccurs);
85     }
86
87     /**
88      * @see org.opencms.xml.types.A_CmsXmlContentValue#createValue(I_CmsXmlDocument, org.dom4j.Element, Locale)
89      */

90     public I_CmsXmlContentValue createValue(I_CmsXmlDocument document, Element element, Locale JavaDoc locale) {
91
92         return new CmsXmlStringValue(document, element, locale, this);
93     }
94
95     /**
96      * @see org.opencms.xml.types.I_CmsXmlSchemaType#getSchemaDefinition()
97      */

98     public String JavaDoc getSchemaDefinition() {
99
100         return "<xsd:simpleType name=\"" + TYPE_NAME + "\"><xsd:restriction base=\"xsd:string\" /></xsd:simpleType>";
101     }
102
103     /**
104      * @see org.opencms.xml.types.A_CmsXmlContentValue#getTypeName()
105      */

106     public String JavaDoc getTypeName() {
107
108         return TYPE_NAME;
109     }
110
111     /**
112      * @see org.opencms.xml.types.A_CmsXmlContentValue#newInstance(java.lang.String, java.lang.String, java.lang.String)
113      */

114     public I_CmsXmlSchemaType newInstance(String JavaDoc name, String JavaDoc minOccurs, String JavaDoc maxOccurs) {
115
116         return new CmsXmlStringValue(name, minOccurs, maxOccurs);
117     }
118 }
Popular Tags