private XElement GetXObject (JObject jobj)
{
var ctx = new ObjectContext(this, jobj);
if (ctx.TypeName == null)
return null;
var xAttrVisibility = GetXAttrObjectVisibility(jobj, ctx.Visibility);
var xAttrsIds = GetXAttrsObjectIds(ctx.ObjId, ctx.TypeInfo).ToArray();
if (typeof(Style).IsAssignableFrom(ctx.TypeInfo.Type))
ProcessStyleObject(ctx);
if (typeof(FrameworkTemplate).IsAssignableFrom(ctx.TypeInfo.Type))
ProcessTemplateObject(ctx);
AssignPropertyTypeInfos(jobj, ctx);
var allProps = new List<JProperty>();
var xAttrsShortProps = GetXAttrsShortProps(jobj, allProps);
return new XElement(Ns + ctx.TypeName,
xAttrVisibility,
xAttrsIds,
xAttrsShortProps,
ctx.JContent == null ? null : GetObjectOrEnum(ctx.JContent).Select(GetXObject).ToArray(),
allProps.Where(IsScalarContentProperty).Select(GetXTextScalarPropertyContent).ToArray(),
allProps.Where(IsComplexProperty).Select(GetXElementComplexProperty).ToArray(),
allProps.Where(IsScalarProperty).Select(GetXAttrScalarProperty).ToArray()
);
}