KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > xs > xml > impl > XsEWhiteSpaceImpl


1 /*
2  * Copyright 2003, 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  */

17 package org.apache.ws.jaxme.xs.xml.impl;
18
19 import org.apache.ws.jaxme.xs.xml.*;
20
21
22 /** <p>Implementation of <code>xs:whiteSpace</code>, following
23  * this specification:
24  * <pre>
25  * &lt;xs:element name="whiteSpace" id="whiteSpace"&gt;
26  * &lt;xs:annotation&gt;
27  * &lt;xs:documentation
28  * source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/&gt;
29  * &lt;/xs:annotation&gt;
30  * &lt;xs:complexType&gt;
31  * &lt;xs:complexContent&gt;
32  * &lt;xs:restriction base="xs:facet"&gt;
33  * &lt;xs:sequence&gt;
34  * &lt;xs:element ref="xs:annotation" minOccurs="0"/&gt;
35  * &lt;/xs:sequence&gt;
36  * &lt;xs:attribute name="value" use="required"&gt;
37  * &lt;xs:simpleType&gt;
38  * &lt;xs:restriction base="xs:NMTOKEN"&gt;
39  * &lt;xs:enumeration value="preserve"/&gt;
40  * &lt;xs:enumeration value="replace"/&gt;
41  * &lt;xs:enumeration value="collapse"/&gt;
42  * &lt;/xs:restriction&gt;
43  * &lt;/xs:simpleType&gt;
44  * &lt;/xs:attribute&gt;
45  * &lt;/xs:restriction&gt;
46  * &lt;/xs:complexContent&gt;
47  * &lt;/xs:complexType&gt;
48  * &lt;/xs:element&gt;
49  * </pre></p>
50  *
51  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
52  */

53 public class XsEWhiteSpaceImpl extends XsTFacetImpl implements XsEWhiteSpace {
54   protected XsEWhiteSpaceImpl(XsObject pParent) {
55     super(pParent);
56   }
57
58   public void setValue(String JavaDoc pValue) {
59     if ("preserve".equals(pValue) || "replace".equals(pValue) ||
60         "collapse".equals(pValue)) {
61       super.setValue(pValue);
62     } else {
63       throw new IllegalArgumentException JavaDoc("Invalid value: " + pValue + "; expected either of 'preserve', 'replace', or 'collapse'");
64     }
65   }
66
67   public boolean isPreserving() {
68     return "preserve".equals(getValue());
69   }
70
71   public boolean isReplacing() {
72     return "replace".equals(getValue());
73   }
74
75   public boolean isCollapsing() {
76     return "collapse".equals(getValue());
77   }
78
79   public String JavaDoc getFacetName() {
80     return "whiteSpace";
81   }
82 }
83
Popular Tags