KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.ArrayList JavaDoc;
20 import java.util.List JavaDoc;
21
22 import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
23 import org.apache.ws.jaxme.xs.xml.*;
24 import org.xml.sax.SAXException JavaDoc;
25
26
27 /** <p>Implementation of <code>xs:redefine</code>, as specified
28  * by the following:
29  * <pre>
30  * &lt;xs:element name="redefine" id="redefine"&gt;
31  * &lt;xs:annotation&gt;
32  * &lt;xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/&gt;
33  * &lt;/xs:annotation&gt;
34  * &lt;xs:complexType&gt;
35  * &lt;xs:complexContent&gt;
36  * &lt;xs:extension base="xs:openAttrs"&gt;
37  * &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
38  * &lt;xs:element ref="xs:annotation"/&gt;
39  * &lt;xs:group ref="xs:redefinable"/&gt;
40  * &lt;/xs:choice&gt;
41  * &lt;xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/&gt;
42  * &lt;xs:attribute name="id" type="xs:ID"/&gt;
43  * &lt;/xs:extension&gt;
44  * &lt;/xs:complexContent&gt;
45  * &lt;/xs:complexType&gt;
46  * &lt;/xs:element&gt;
47  * </pre></p>
48  *
49  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
50  */

51 public class XsERedefineImpl extends XsTAnnotatedImpl implements XsERedefine {
52   protected XsERedefineImpl(XsObject pParent) {
53     super(pParent);
54   }
55
56   private List JavaDoc childs;
57   private XsAnyURI schemaLocation;
58
59   public void setSchemaLocation(XsAnyURI pSchemaLocation) {
60     schemaLocation = pSchemaLocation;
61   }
62
63   public XsAnyURI getSchemaLocation() {
64     return schemaLocation;
65   }
66
67   public XsEAnnotation createAnnotation() {
68     XsEAnnotation annotation = getObjectFactory().newXsEAnnotation(this);
69     if (childs == null) {
70       childs = new ArrayList JavaDoc();
71     }
72     childs.add(annotation);
73     return annotation;
74   }
75
76   public XsETopLevelSimpleType createSimpleType() {
77     XsETopLevelSimpleType simpleType = getObjectFactory().newXsETopLevelSimpleType(this);
78     if (childs == null) {
79       childs = new ArrayList JavaDoc();
80     }
81     childs.add(simpleType);
82     return simpleType;
83   }
84
85   public XsTComplexType createComplexType() {
86     XsTComplexType complexType = getObjectFactory().newXsTComplexType(this);
87     if (childs == null) {
88       childs = new ArrayList JavaDoc();
89     }
90     childs.add(complexType);
91     return complexType;
92   }
93
94   public XsTGroup createGroup() {
95     XsTGroup group = getObjectFactory().newXsTGroup(this);
96     if (childs == null) {
97       childs = new ArrayList JavaDoc();
98     }
99     childs.add(group);
100     return group;
101   }
102
103   public XsTAttributeGroup createAttributeGroup() {
104     XsTAttributeGroup attributeGroup = getObjectFactory().newXsTAttributeGroup(this);
105     if (childs == null) {
106       childs = new ArrayList JavaDoc();
107     }
108     childs.add(attributeGroup);
109     return attributeGroup;
110   }
111
112   public Object JavaDoc[] getChilds() {
113     if (childs == null) {
114       return new Object JavaDoc[0];
115     }
116     return childs.toArray();
117   }
118
119   public void validate() throws SAXException {
120     super.validate();
121     if (getSchemaLocation() == null) {
122       throw new LocSAXException("Missing attribute: 'schemaLocation'", getLocator());
123     }
124   }
125 }
126
Popular Tags