NS_ASSERTION(rv != NS_RDF_NO_VALUE, "null item in cursor"); if (rv == NS_RDF_NO_VALUE) continue;
RDFXMLDataSourceImpl::SerializeMember(nsIOutputStream* aStream,                                      nsIRDFResource* aContainer,                                      nsIRDFResource* aProperty){    nsresult rv;    // We open a cursor rather than just doing GetTarget() because    // there may for some random reason be two or more elements with    // the same ordinal value. Okay, I'm paranoid.    nsCOMPtr<nsIRDFAssertionCursor> cursor;    if (NS_FAILED(rv = mInner->GetTargets(aContainer, aProperty, PR_TRUE, getter_AddRefs(cursor))))        return rv;    nsXPIDLCString docURI;    mInner->GetURI(getter_Copies(docURI));    while (1) {        rv = cursor->Advance();        if (NS_FAILED(rv))            return rv;        if (rv == NS_RDF_CURSOR_EMPTY)            break;        nsIRDFNode* node;        if (NS_FAILED(rv = cursor->GetTarget(&node)))            break;        // If it's a resource, then output a "<RDF:li resource=... />"        // tag, because we'll be dumping the resource separately. (We        // iterate thru all the resources in the datasource,        // remember?) Otherwise, output the literal value.        nsIRDFResource* resource = nsnull;        nsIRDFLiteral* literal = nsnull;        if (NS_SUCCEEDED(rv = node->QueryInterface(kIRDFResourceIID, (void**) &resource))) {            nsXPIDLCString s;            if (NS_SUCCEEDED(rv = resource->GetValue( getter_Copies(s) ))) {static const char kRDFLIResource1[] = "    <RDF:li RDF:resource=\"";static const char kRDFLIResource2[] = "\"/>\n";                nsAutoString uri(s);                rdf_PossiblyMakeRelative((const char*) docURI, uri);                rdf_EscapeAmpersands(uri);                rdf_BlockingWrite(aStream, kRDFLIResource1, sizeof(kRDFLIResource1) - 1);                rdf_BlockingWrite(aStream, uri);                rdf_BlockingWrite(aStream, kRDFLIResource2, sizeof(kRDFLIResource2) - 1);            }            NS_RELEASE(resource);        }        else if (NS_SUCCEEDED(rv = node->QueryInterface(kIRDFLiteralIID, (void**) &literal))) {            nsXPIDLString value;            if (NS_SUCCEEDED(rv = literal->GetValue( getter_Copies(value) ))) {static const char kRDFLILiteral1[] = "    <RDF:li>";static const char kRDFLILiteral2[] = "</RDF:li>\n";                rdf_BlockingWrite(aStream, kRDFLILiteral1, sizeof(kRDFLILiteral1) - 1);                rdf_BlockingWrite(aStream, (const PRUnichar*) value);                rdf_BlockingWrite(aStream, kRDFLILiteral2, sizeof(kRDFLILiteral2) - 1);            }            NS_RELEASE(literal);        }        else {            NS_ASSERTION(PR_FALSE, "uhh -- it's not a literal or a resource?");        }        NS_RELEASE(node);        if (NS_FAILED(rv))            break;    }    return NS_OK;}