String simple = getSimpleContent(elem);
if (elem.hasAttributes() || simple==null) {
// looks like a complex type
Resource obj = null;
if (elem.hasAttributeNS(XML,"id")) {
String id = elem.getAttributeNS(XML,"id");
obj = m.createResource(addFragment(ctx.getBaseMap(), id).toString());
}
else obj = m.createResource();
// explicit xsi:type
if (elem.hasAttributeNS(schema.XSI,"type")) {
String t = elem.getAttributeNS(schema.XSI,"type");
String fullname = expandQName(ctx.getDefaultNS(),t,elem,ctx.getModel());
complexType c = ctx.getComplexType(fullname);
if (c!=null) {
String id = c.getID(elem,ctx);
Resource o = id==null?m.createResource():m.createResource(addFragment(ctx.getBaseMap(), id).toString());
stmt = m.createStatement(subject,prop,o);
// the new resource, o, becomes the subject
Seq subSeq = null;
if (ctx.isSequenced() && elem.hasChildNodes() && c.needSeq(new HashSet<String>(), ctx))
subSeq = m.getSeq(o.addProperty(RDF.type, RDF.Seq));
int index = c.toRDF(o, elem, 0, subSeq,null,true,ctx);
// mop up remaining values in sequence
produceMixed(subSeq, index, elem);