KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > types > Language


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.types;
17
18 import org.apache.axis.utils.Messages;
19
20 /**
21  * Custom class for supporting XSD data type language
22  * language represents natural language identifiers as defined by [RFC 1766].
23  * The value space of language is the set of all strings that are valid language identifiers
24  * as defined in the language identification section of [XML 1.0 (Second Edition)].
25  * The lexical space of language is the set of all strings that are valid language identifiers
26  * as defined in the language identification section of [XML 1.0 (Second Edition)].
27  * The base type of language is token.
28  *
29  * @author Eddie Pick <eddie@pick.eu.org>
30  * @see <a HREF="http://www.w3.org/TR/xmlschema-2/#language">XML Schema 3.3.3</a>
31  */

32 public class Language extends Token {
33
34     public Language() {
35         super();
36     }
37
38     /**
39      * ctor for Language
40      * @exception IllegalArgumentException will be thrown if validation fails
41      */

42     public Language(String JavaDoc stValue) throws IllegalArgumentException JavaDoc {
43         try {
44             setValue(stValue);
45         }
46         catch (IllegalArgumentException JavaDoc e) {
47             // recast normalizedString exception as token exception
48
throw new IllegalArgumentException JavaDoc(
49                 Messages.getMessage("badLanguage00") + "data=[" +
50                 stValue + "]");
51         }
52     }
53
54    /**
55     *
56     * validate the value against the xsd definition
57     * TODO
58     * @see <a HREF="http://www.ietf.org/rfc/rfc1766.txt">RFC1766</a>
59     * Language-Tag = Primary-tag *( "-" Subtag )
60     * Primary-tag = 1*8ALPHA
61     * Subtag = 1*8ALPHA
62     */

63     public static boolean isValid(String JavaDoc stValue) {
64         return true;
65     }
66 }
67
Popular Tags