return null;
XMLAnalysisException ex = new XMLAnalysisException("Malformed @Type argument '" + annotation + "'", getCurrentOrigin());
annotation = annotation.trim();
// make schema
SchemaType schema;
int leftbrack = annotation.indexOf('[');
int rightbrack = annotation.lastIndexOf(']');
if (leftbrack<0 != rightbrack<0)
throw ex;
if (leftbrack<0 || rightbrack<0) {
// no gap annotations
schema = new SchemaType(expandQName(annotation), origin);
} else {
// parse gap annotations
String start = annotation.substring(0, leftbrack).trim();
String gaps = annotation.substring(leftbrack+1, rightbrack).trim();
String[] ga = gaps.split(",");
if (ga.length==0)
ga = new String[]{ gaps };
// build gap info
Collection<String> tgaps = new LinkedHashSet<String>();
Collection<String> agaps = new LinkedHashSet<String>();
Map<String,String> gap_types = new LinkedHashMap<String,String>();
for (String g : ga) {
g = g.trim();
int space = g.indexOf(' ');
if (space<0)
throw ex;
String gaptype = g.substring(0, space).trim();
String gapname = g.substring(space+1).trim();
Collection<String> set;
if (gapname.startsWith("@")) { // attribute gap?
gapname = gapname.substring(1);
set = agaps;
} else
set = tgaps;
set.add(gapname);
gap_types.put(gapname, gaptype);
}
schema = new SchemaType(expandQName(start), tgaps, agaps, expandQNames(gap_types), origin);
}
return schema;
}