char *val = textFrags->Get1b();
const char *val = textFrags->Get1b();
XULSortServiceImpl::PrintTreeChildren(nsIContent *container, PRInt32 colIndex, PRInt32 indentLevel){	PRInt32			childIndex = 0, numChildren = 0, nameSpaceID;        nsCOMPtr<nsIContent>	child;	nsresult		rv;	if (NS_FAILED(rv = container->ChildCount(numChildren)))	return(rv);	for (childIndex=0; childIndex<numChildren; childIndex++)	{		if (NS_FAILED(rv = container->ChildAt(childIndex, *getter_AddRefs(child))))	return(rv);		if (NS_FAILED(rv = child->GetNameSpaceID(nameSpaceID)))	return(rv);		if (nameSpaceID == kNameSpaceID_XUL)		{			nsCOMPtr<nsIAtom> tag;			if (NS_FAILED(rv = child->GetTag(*getter_AddRefs(tag))))				return rv;			nsString	tagName;			tag->ToString(tagName);			for (PRInt32 indentLoop=0; indentLoop<indentLevel; indentLoop++) printf("    ");			printf("Child #%d: tagName='%s'\n", childIndex, tagName.ToNewCString());			PRInt32		attribIndex, numAttribs;			child->GetAttributeCount(numAttribs);			for (attribIndex = 0; attribIndex < numAttribs; attribIndex++)			{				PRInt32			attribNameSpaceID;				nsCOMPtr<nsIAtom> 	attribAtom;				if (NS_SUCCEEDED(rv = child->GetAttributeNameAt(attribIndex, attribNameSpaceID,					*getter_AddRefs(attribAtom))))				{					nsString	attribName, attribValue;					attribAtom->ToString(attribName);					rv = child->GetAttribute(attribNameSpaceID, attribAtom, attribValue);					if (rv == NS_CONTENT_ATTR_HAS_VALUE)					{						for (PRInt32 indentLoop=0; indentLoop<indentLevel; indentLoop++) printf("    ");						printf("Attrib #%d: name='%s' value='%s'\n", attribIndex,							attribName.ToNewCString(),							attribValue.ToNewCString());					}				}			}			if ((tag.get() == kTreeItemAtom) || (tag.get() == kTreeChildrenAtom) || (tag.get() == kTreeCellAtom))			{				PrintTreeChildren(child, colIndex, indentLevel+1);			}		}		else		{			for (PRInt32 loop=0; loop<indentLevel; loop++) printf("    ");			printf("(Non-XUL node)  ");			nsITextContent	*text = nsnull;			if (NS_SUCCEEDED(rv = child->QueryInterface(kITextContentIID, (void **)&text)))			{				for (PRInt32 indentLoop=0; indentLoop<indentLevel; indentLoop++) printf("    ");				printf("(kITextContentIID)  ");				const nsTextFragment	*textFrags;				PRInt32		numTextFrags;				if (NS_SUCCEEDED(rv = text->GetText(textFrags, numTextFrags)))				{					char *val = textFrags->Get1b();					PRInt32 len = textFrags->GetLength();					if (val)	printf("value='%.*s'", len, val);				}			}			printf("\n");		}	}	return(NS_OK);}