01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the "License"). You may not use this file except
05: * in compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://jwsdp.dev.java.net/CDDLv1.0.html
09: * See the License for the specific language governing
10: * permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL
13: * HEADER in each file and include the License file at
14: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
15: * add the following below this CDDL HEADER, with the
16: * fields enclosed by brackets "[]" replaced with your
17: * own identifying information: Portions Copyright [yyyy]
18: * [name of copyright owner]
19: */
20: package com.sun.xml.xsom.impl;
21:
22: import com.sun.xml.xsom.XSAttGroupDecl;
23: import com.sun.xml.xsom.XSAttributeUse;
24: import com.sun.xml.xsom.XSWildcard;
25: import com.sun.xml.xsom.impl.parser.DelayedRef;
26: import com.sun.xml.xsom.impl.parser.SchemaDocumentImpl;
27: import com.sun.xml.xsom.visitor.XSFunction;
28: import com.sun.xml.xsom.visitor.XSVisitor;
29: import org.xml.sax.Locator;
30:
31: import java.util.Iterator;
32:
33: public class AttGroupDeclImpl extends AttributesHolder implements
34: XSAttGroupDecl {
35: public AttGroupDeclImpl(SchemaDocumentImpl _parent,
36: AnnotationImpl _annon, Locator _loc,
37: ForeignAttributesImpl _fa, String _name,
38: WildcardImpl _wildcard) {
39:
40: this (_parent, _annon, _loc, _fa, _name);
41: setWildcard(_wildcard);
42: }
43:
44: public AttGroupDeclImpl(SchemaDocumentImpl _parent,
45: AnnotationImpl _annon, Locator _loc,
46: ForeignAttributesImpl _fa, String _name) {
47:
48: super (_parent, _annon, _loc, _fa, _name, false);
49: }
50:
51: private WildcardImpl wildcard;
52:
53: public void setWildcard(WildcardImpl wc) {
54: wildcard = wc;
55: }
56:
57: public XSWildcard getAttributeWildcard() {
58: return wildcard;
59: }
60:
61: public XSAttributeUse getAttributeUse(String nsURI, String localName) {
62: UName name = new UName(nsURI, localName);
63: XSAttributeUse o = null;
64:
65: Iterator itr = iterateAttGroups();
66: while (itr.hasNext() && o == null)
67: o = ((XSAttGroupDecl) itr.next()).getAttributeUse(nsURI,
68: localName);
69:
70: if (o == null)
71: o = attributes.get(name);
72:
73: return o;
74: }
75:
76: public void redefine(AttGroupDeclImpl ag) {
77: for (Iterator itr = attGroups.iterator(); itr.hasNext();) {
78: DelayedRef.AttGroup r = (DelayedRef.AttGroup) itr.next();
79: r.redefine(ag);
80: }
81: }
82:
83: public void visit(XSVisitor visitor) {
84: visitor.attGroupDecl(this );
85: }
86:
87: public Object apply(XSFunction function) {
88: return function.attGroupDecl(this);
89: }
90: }
|