while (1) { PRBool hasMore; rv = resources->HasMoreElements(&hasMore); if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIRDFXMLSource> source = do_QueryInterface(serializer); if (! source) return NS_ERROR_FAILURE;
RDFXMLDataSourceImpl::Serialize(nsIOutputStream* aStream){    nsresult rv;    nsCOMPtr<nsISimpleEnumerator> resources;    rv = mInner->GetAllResources(getter_AddRefs(resources));    if (NS_FAILED(rv)) return rv;    rv = SerializePrologue(aStream);    if (NS_FAILED(rv))        return rv;    while (1) {        PRBool hasMore;        rv = resources->HasMoreElements(&hasMore);        if (NS_FAILED(rv)) return rv;        if (! hasMore)            break;        nsIRDFResource* resource;        rv = resources->GetNext((nsISupports**) &resource);        if (NS_FAILED(rv))            break;        if (IsA(mInner, resource, kRDF_Bag) ||            IsA(mInner, resource, kRDF_Seq) ||            IsA(mInner, resource, kRDF_Alt)) {            rv = SerializeContainer(aStream, resource);        }        else {            rv = SerializeDescription(aStream, resource);        }        NS_RELEASE(resource);        if (NS_FAILED(rv))            break;    }    rv = SerializeEpilogue(aStream);    return rv;}