char *uri = sortResource.ToNewCString();
char *uri = currentSortResource.ToNewCString();
XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,                           const nsString& sortDirection){	PRInt32		colIndex, treeBodyIndex;	nsIContent	*contentNode, *treeNode, *treeBody, *treeParent;	nsresult	rv;	_sortStruct	sortInfo;	if (NS_FAILED(rv = node->QueryInterface(kIContentIID, (void**)&contentNode)))	return(rv);	if (NS_FAILED(rv = FindTreeElement(contentNode, &treeNode)))	return(rv);	nsAutoString currentSortDirection;	sortInfo.db = nsnull;	sortInfo.sortProperty = nsnull;	if (NS_SUCCEEDED(rv = GetSortColumnInfo(treeNode, (nsString &)sortResource, (nsString &)currentSortDirection)))	{		char *uri = sortResource.ToNewCString();		rv = gRDFService->GetResource(uri, &sortInfo.sortProperty);		delete [] uri;		if (NS_FAILED(rv))	return(rv);	}	if (sortDirection.EqualsIgnoreCase("natural"))	{		sortInfo.naturalOrderSort = PR_TRUE;		sortInfo.descendingSort = PR_FALSE;	}	else	{		sortInfo.naturalOrderSort = PR_FALSE;;		if (sortDirection.EqualsIgnoreCase("ascending"))	sortInfo.descendingSort = PR_FALSE;		else if (sortDirection.EqualsIgnoreCase("descending"))	sortInfo.descendingSort = PR_TRUE;	}	if (NS_FAILED(rv = GetSortColumnIndex(treeNode, sortResource, sortDirection, &colIndex)))	return(rv);	if (NS_FAILED(rv = FindTreeBodyElement(treeNode, &treeBody)))	return(rv);	if (NS_FAILED(rv = treeBody->GetParent(treeParent)))	return(rv);	if (NS_FAILED(rv = treeParent->IndexOf(treeBody, treeBodyIndex)))	return(rv);	if (NS_FAILED(rv = treeParent->RemoveChildAt(treeBodyIndex, PR_TRUE)))	return(rv);	if (NS_SUCCEEDED(rv = SortTreeChildren(treeBody, colIndex, &sortInfo, 0)))	{	}	if (NS_SUCCEEDED(rv = treeBody->UnsetAttribute(kNameSpaceID_None,		kTreeContentsGeneratedAtom,PR_FALSE)))	{	}	if (NS_SUCCEEDED(rv = treeParent->UnsetAttribute(kNameSpaceID_None,		kTreeContentsGeneratedAtom,PR_FALSE)))	{	}	if (NS_FAILED(rv = treeParent->AppendChildTo(treeBody, PR_TRUE)))	return(rv);#if 0	if (NS_FAILED(rv = PrintTreeChildren(treeBody, colIndex, 0)))	return(rv);#endif	return(NS_OK);}