entry->Prefix->ToString(nameSpacePrefix);
if (entry->Prefix) { entry->Prefix->ToString(nameSpacePrefix); } else { nameSpacePrefix.Truncate(); }
RDFXMLDataSourceImpl::MakeQName(nsIRDFResource* resource,                                nsString& property,                                nsString& nameSpacePrefix,                                nsString& nameSpaceURI){    const char* s;    resource->GetValue(&s);    nsAutoString uri(s);    for (NameSpaceMap* entry = mNameSpaces; entry != nsnull; entry = entry->Next) {        if (uri.Find(entry->URI) == 0) {            nameSpaceURI    = entry->URI;            entry->Prefix->ToString(nameSpacePrefix);            uri.Right(property, uri.Length() - nameSpaceURI.Length());            return PR_TRUE;        }    }    // Okay, so we don't have it in our map. Try to make one up.    PRInt32 index = uri.RFind('#'); // first try a '#'    if (index == -1) {        index = uri.RFind('/');        if (index == -1) {            // Okay, just punt and assume there is _no_ namespace on            // this thing...            NS_ASSERTION(PR_FALSE, "couldn't find reasonable namespace prefix");            nameSpaceURI.Truncate();            nameSpacePrefix.Truncate();            property = uri;            return PR_TRUE;        }    }    // Take whatever is to the right of the '#' and call it the    // property.    property.Truncate();    nameSpaceURI.Right(property, uri.Length() - (index + 1));    // Truncate the namespace URI down to the string up to and    // including the '#'.    nameSpaceURI = uri;    nameSpaceURI.Truncate(index + 1);    // Just generate a random prefix    static PRInt32 gPrefixID = 0;    nameSpacePrefix = "NS";    nameSpacePrefix.Append(++gPrefixID, 10);    return PR_FALSE;}