bool FArchiveXML::LoadEntityInstance(FCDObject* object, xmlNode* instanceNode)
{ 
	FCDEntityInstance* entityInstance = (FCDEntityInstance*)object;

	bool status = true;

	FUUri uri = ReadNodeUrl(instanceNode);
	entityInstance->GetEntityReference()->SetUri(uri);
	if (!entityInstance->IsExternalReference() && entityInstance->GetEntity() == NULL)
	{
		FUError::Error(FUError::WARNING_LEVEL, FUError::WARNING_INST_ENTITY_MISSING, instanceNode->line);
	}

	entityInstance->SetWantedSubId(TO_STRING(ReadNodeSid(instanceNode)));
	entityInstance->SetName(TO_FSTRING(ReadNodeName(instanceNode)));

	// Read in the extra nodes
	xmlNodeList extraNodes;
	FindChildrenByType(instanceNode, DAE_EXTRA_ELEMENT, extraNodes);
	for (xmlNodeList::iterator it = extraNodes.begin(); it != extraNodes.end(); ++it)
	{
		xmlNode* extraNode = (*it);
		FArchiveXML::LoadExtra(entityInstance->GetExtra(), extraNode);
	}

	entityInstance->SetDirtyFlag(); 
	return status;
}