if (s.getSchema() != null)
linkSchemaType(s, s.getSchema());
}
@Override
public void visitConstStm(ConstStm s) {
TemplateConstant t = s.getConst();
if (t.getFragment() != null)
return;
// handle empty XML specially to avoid "" text nodes
if (t.getXML().isText() && t.getXML().asText().getString().isEmpty()) {
SequenceNode n = new SequenceNode(Collections.<Integer>emptyList(), s.getOrigin());
xg.addNode(n);
XMLGraphFragment f = new XMLGraphFragment(n, null, null, null);
t.setFragment(f);
} else {
XMLGraphFragment f = XMLGraphConverter.extend(xg, t.getXML(), XMLGraphConverter.GapConversion.CLOSED, true);
for (Map.Entry<String,String> en : f.getGapTypeMap().entrySet()) {
String gaptype = en.getValue();
// add gap types to the xml graph, and ensure that they are valid
resolveTypename(gaptype);
}
t.setFragment(f);
}
}
void linkSchemaType(Statement s, SchemaType type) {
type.setTypeNode(resolveTypename(type.getType()));
for (Map.Entry<String,String> gap : type.getGapTypes().entrySet()) {