1
|
|
/*
|
2
|
|
* JBind
|
3
|
|
*
|
4
|
|
* Copyright (c) by Stefan Wachter. All rights reserved.
|
5
|
|
*
|
6
|
|
* Usage, modification, and redistribution is subject to license terms that are
|
7
|
|
* available at 'http://www.jbind.org'. The JBind license is like the
|
8
|
|
* 'Apache Software License V 1.1'.
|
9
|
|
*/
|
10
|
|
package org.jbind.xml.schema.cmp;
|
11
|
|
|
12
|
|
import java.util.Collections;
|
13
|
|
import java.util.HashSet;
|
14
|
|
import java.util.Map;
|
15
|
|
import java.util.Set;
|
16
|
|
|
17
|
|
import org.jbind.xml.base.FinalType;
|
18
|
|
import org.jbind.xml.base.IHasLocation;
|
19
|
|
import org.jbind.xml.base.ILocation;
|
20
|
|
import org.jbind.xml.base.INamespaces;
|
21
|
|
import org.jbind.xml.base.ProcessContentsType;
|
22
|
|
import org.jbind.xml.base.Range;
|
23
|
|
import org.jbind.xml.core.cmp.IAttributesModel;
|
24
|
|
import org.jbind.xml.core.cmp.IComponentVisitor;
|
25
|
|
import org.jbind.xml.core.cmp.ISourceInfo;
|
26
|
|
import org.jbind.xml.core.cmp.IWildcard;
|
27
|
|
import org.jbind.xml.core.constraint.ICheckContext;
|
28
|
|
import org.jbind.xml.core.data.IDataCreator;
|
29
|
|
import org.jbind.xml.core.type.IAnyType;
|
30
|
|
import org.jbind.xml.core.type.ISimpleType;
|
31
|
|
import org.jbind.xml.msg.XmlException;
|
32
|
|
import org.jbind.xml.schema.constraint.Constraints;
|
33
|
|
|
34
|
|
public class AnyType extends AbstractType implements IHasLocation {
|
35
|
|
|
36
|
|
private static Set FINAL_TYPES = new HashSet(23);
|
37
|
|
|
38
|
|
static {
|
39
|
3
|
FINAL_TYPES.add(FinalType.EXTENSION);
|
40
|
3
|
FINAL_TYPES.add(FinalType.LIST);
|
41
|
3
|
FINAL_TYPES.add(FinalType.UNION);
|
42
|
|
}
|
43
|
|
|
44
|
3
|
public AnyType(ISourceInfo aSourceInfo, IDataCreator aDataCreator) {
|
45
|
3
|
super(aSourceInfo, INamespaces.XML_SCHEMA, "anyType", null, FINAL_TYPES, Collections.EMPTY_SET, false);
|
46
|
3
|
IWildcard attributeWildcard = new Wildcard(true, Collections.EMPTY_SET, ProcessContentsType.LAX);
|
47
|
3
|
IAttributesModel am = new AttributesModel(this);
|
48
|
3
|
am.setWildcard(attributeWildcard);
|
49
|
3
|
setAttributesModel(am);
|
50
|
|
|
51
|
|
// The content model: A mixed sequence (1,1) of an unbounded wildcard part
|
52
|
3
|
ComplexContentModel cm = new ComplexContentModel();
|
53
|
3
|
setContentModel(cm);
|
54
|
3
|
cm.setIsMixed(true);
|
55
|
3
|
SequenceDecl group = new SequenceDecl(this, null, null, Range.ONE);
|
56
|
3
|
Wildcard wildcard = new Wildcard(true, Collections.EMPTY_SET, ProcessContentsType.LAX);
|
57
|
3
|
group.add(new ElemWildcard(this, Range.ZERO_TO_UNBOUNDED, wildcard));
|
58
|
3
|
cm.setGroup(group);
|
59
|
|
|
60
|
3
|
setConstraints(new Constraints());
|
61
|
3
|
setDataCreator(aDataCreator);
|
62
|
|
}
|
63
|
|
|
64
|
108
|
public boolean isSimple() {
|
65
|
108
|
return false;
|
66
|
|
}
|
67
|
|
|
68
|
387
|
public boolean isComplex() {
|
69
|
387
|
return false;
|
70
|
|
}
|
71
|
|
|
72
|
0
|
public boolean isExtension() {
|
73
|
0
|
return false;
|
74
|
|
}
|
75
|
|
|
76
|
0
|
public ISimpleType getSimpleContentType() {
|
77
|
0
|
return null;
|
78
|
|
}
|
79
|
|
|
80
|
0
|
public void accept(IComponentVisitor aVisitor) throws XmlException {
|
81
|
0
|
aVisitor.visitAnyTypeStart(this);
|
82
|
0
|
visitSubComponents(aVisitor);
|
83
|
0
|
aVisitor.visitAnyTypeEnd(this);
|
84
|
|
}
|
85
|
|
|
86
|
3797
|
public void checkEnclosedConstraints(ICheckContext aContext) {}
|
87
|
|
|
88
|
0
|
public ILocation getLocation() {
|
89
|
0
|
return BuiltInLocation.INSTANCE;
|
90
|
|
}
|
91
|
|
|
92
|
577
|
public Class getSimpleStorageType() {
|
93
|
577
|
return null;
|
94
|
|
}
|
95
|
|
|
96
|
238
|
public final IAnyType getInstanceType() {
|
97
|
238
|
return this;
|
98
|
|
}
|
99
|
|
|
100
|
269
|
public Map getXPathMethods() {
|
101
|
269
|
return Collections.EMPTY_MAP;
|
102
|
|
}
|
103
|
|
|
104
|
202
|
protected boolean isUnion() {
|
105
|
202
|
return false;
|
106
|
|
}
|
107
|
|
}
|
108
|
|
|