View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 1999-2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package com.sun.org.apache.xerces.internal.impl.xs;
22  
23  
24  import com.sun.org.apache.xerces.internal.impl.xs.util.XSObjectListImpl;
25  import com.sun.org.apache.xerces.internal.xs.XSAnnotation;
26  import com.sun.org.apache.xerces.internal.xs.XSConstants;
27  import com.sun.org.apache.xerces.internal.xs.XSModelGroup;
28  import com.sun.org.apache.xerces.internal.xs.XSModelGroupDefinition;
29  import com.sun.org.apache.xerces.internal.xs.XSNamespaceItem;
30  import com.sun.org.apache.xerces.internal.xs.XSObjectList;
31  
32  /**
33   * The XML representation for a group declaration
34   * schema component is a global <group> element information item
35   *
36   * @xerces.internal
37   *
38   * @author Sandy Gao, IBM
39   * @version $Id: XSGroupDecl.java,v 1.7 2010-11-01 04:39:55 joehw Exp $
40   */
41  public class XSGroupDecl implements XSModelGroupDefinition {
42  
43      // name of the group
44      public String fName = null;
45      // target namespace of the group
46      public String fTargetNamespace = null;
47      // model group of the group
48      public XSModelGroupImpl fModelGroup = null;
49      // optional annotations
50      public XSObjectList fAnnotations = null;
51      // The namespace schema information item corresponding to the target namespace
52      // of the model group definition, if it is globally declared; or null otherwise.
53      private XSNamespaceItem fNamespaceItem = null;
54  
55      /**
56       * Get the type of the object, i.e ELEMENT_DECLARATION.
57       */
58      public short getType() {
59          return XSConstants.MODEL_GROUP_DEFINITION;
60      }
61  
62      /**
63       * The <code>name</code> of this <code>XSObject</code> depending on the
64       * <code>XSObject</code> type.
65       */
66      public String getName() {
67          return fName;
68      }
69  
70      /**
71       * The namespace URI of this node, or <code>null</code> if it is
72       * unspecified.  defines how a namespace URI is attached to schema
73       * components.
74       */
75      public String getNamespace() {
76          return fTargetNamespace;
77      }
78  
79      /**
80       * {model group} A model group.
81       */
82      public XSModelGroup getModelGroup() {
83          return fModelGroup;
84      }
85  
86      /**
87       * Optional. Annotation.
88       */
89      public XSAnnotation getAnnotation() {
90          return (fAnnotations != null) ? (XSAnnotation) fAnnotations.item(0) : null;
91      }
92  
93      /**
94       * Optional. Annotations.
95       */
96      public XSObjectList getAnnotations() {
97          return (fAnnotations != null) ? fAnnotations : XSObjectListImpl.EMPTY_LIST;
98      }
99  
100     /**
101      * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
102      */
103     public XSNamespaceItem getNamespaceItem() {
104         return fNamespaceItem;
105     }
106 
107     void setNamespaceItem(XSNamespaceItem namespaceItem) {
108         fNamespaceItem = namespaceItem;
109     }
110 
111 } // class XSGroupDecl