rdf_BlockingWrite(aStream, " ID=\"", 9);
rdf_BlockingWrite(aStream, kIDEquals, sizeof(kIDEquals) - 1);
RDFXMLDataSourceImpl::SerializeContainer(nsIOutputStream* aStream,                                         nsIRDFResource* aContainer){static const char kRDFBag[] = "RDF:Bag";static const char kRDFSeq[] = "RDF:Seq";static const char kRDFAlt[] = "RDF:Alt";    nsresult rv;    const char* tag;    // Decide if it's a sequence, bag, or alternation, and print the    // appropriate tag-open sequence    if (rdf_IsA(mInner, aContainer, kRDF_Bag)) {        tag = kRDFBag;    }    else if (rdf_IsA(mInner, aContainer, kRDF_Seq)) {        tag = kRDFSeq;    }    else if (rdf_IsA(mInner, aContainer, kRDF_Alt)) {        tag = kRDFAlt;    }    else {        NS_ASSERTION(PR_FALSE, "huh? this is _not_ a container.");        return NS_ERROR_UNEXPECTED;    }    rdf_BlockingWrite(aStream, "  <", 3);    rdf_BlockingWrite(aStream, tag);    // Unfortunately, we always need to print out the identity of the    // resource, even if was constructed "anonymously". We need to do    // this because we never really know who else might be referring    // to it...    nsXPIDLCString docURI;    mInner->GetURI( getter_Copies(docURI) );    nsXPIDLCString s;    if (NS_SUCCEEDED(aContainer->GetValue( getter_Copies(s) ))) {        nsAutoString uri(s);        rdf_PossiblyMakeRelative((const char*) docURI, uri);        rdf_EscapeAmpersands(uri);        rdf_BlockingWrite(aStream, " ID=\"", 9);        rdf_BlockingWrite(aStream, uri);        rdf_BlockingWrite(aStream, "\"", 1);    }    rdf_BlockingWrite(aStream, ">\n", 2);    // We iterate through all of the arcs, in case someone has applied    // properties to the bag itself.    nsCOMPtr<nsISimpleEnumerator> arcs;    rv = mInner->ArcLabelsOut(aContainer, getter_AddRefs(arcs));    if (NS_FAILED(rv)) return rv;    NS_WITH_SERVICE(nsIRDFContainerUtils, rdfc, kRDFContainerUtilsCID, &rv);    if (NS_FAILED(rv)) return rv;    while (1) {        PRBool hasMore;        rv = arcs->HasMoreElements(&hasMore);        if (NS_FAILED(rv)) return rv;        if (! hasMore)            break;        nsIRDFResource* property;        rv = arcs->GetNext((nsISupports**) &property);        if (NS_FAILED(rv)) return rv;        // If it's a membership property, then output a "LI"        // tag. Otherwise, output a property.        PRBool isOrdinal;        if (NS_SUCCEEDED(rdfc->IsOrdinalProperty(property, &isOrdinal)) && isOrdinal) {            rv = SerializeMember(aStream, aContainer, property);        }        else if (property == kRDF_instanceOf) {            // don't serialize instanceOf -- it's implicit in the tag        }        else if (property == kRDF_nextVal) {            // don't serialize nextVal -- it's internal state        }        else {            rv = SerializeProperty(aStream, aContainer, property);        }        NS_RELEASE(property);        if (NS_FAILED(rv))            break;    }    // close the container tag    rdf_BlockingWrite(aStream, "  </", 4);    rdf_BlockingWrite(aStream, tag);    rdf_BlockingWrite(aStream, ">\n", 2);    return NS_OK;}