nsCAutoString typeStr;
const char* attrName; localName->GetUTF8String(&attrName);
RDFContentSinkImpl::OpenObject(const PRUnichar* aName,                                const PRUnichar** aAttributes){    // an "object" non-terminal is either a "description", a "typed    // node", or a "container", so this change the content sink's    // state appropriately.    nsresult rv;    nsCOMPtr<nsIAtom> tag;    const char* nameSpaceURI;    ParseTagString(aName, &nameSpaceURI, getter_AddRefs(tag));    // Figure out the URI of this object, and create an RDF node for it.    nsCOMPtr<nsIRDFResource> source;    GetIdAboutAttribute(aAttributes, getter_AddRefs(source));    // If there is no `ID' or `about', then there's not much we can do.    if (! source)        return NS_ERROR_FAILURE;    // Push the element onto the context stack    PushContext(source, mState, mParseMode);    // Now figure out what kind of state transition we need to    // make. We'll either be going into a mode where we parse a    // description or a container.    PRBool isaTypedNode = PR_TRUE;    if (nameSpaceURI && 0 == PL_strcmp(nameSpaceURI, kRDFNameSpaceURI)) {        isaTypedNode = PR_FALSE;        if (tag.get() == kDescriptionAtom) {            // it's a description            mState = eRDFContentSinkState_InDescriptionElement;        }        else if (tag.get() == kBagAtom) {            // it's a bag container            InitContainer(kRDF_Bag, source);            mState = eRDFContentSinkState_InContainerElement;        }        else if (tag.get() == kSeqAtom) {            // it's a seq container            InitContainer(kRDF_Seq, source);            mState = eRDFContentSinkState_InContainerElement;        }        else if (tag.get() == kAltAtom) {            // it's an alt container            InitContainer(kRDF_Alt, source);            mState = eRDFContentSinkState_InContainerElement;        }        else {            // heh, that's not *in* the RDF namespace: just treat it            // like a typed node            isaTypedNode = PR_TRUE;        }    }    if (isaTypedNode) {        nsCAutoString typeStr;        if (nameSpaceURI)            typeStr = nameSpaceURI;        nsAutoString attrName;        tag->ToString(attrName);        typeStr += NS_ConvertUCS2toUTF8(attrName);        nsCOMPtr<nsIRDFResource> type;        rv = gRDFService->GetResource(typeStr, getter_AddRefs(type));        if (NS_FAILED(rv)) return rv;        rv = mDataSource->Assert(source, kRDF_type, type, PR_TRUE);        if (NS_FAILED(rv)) return rv;        mState = eRDFContentSinkState_InDescriptionElement;    }    AddProperties(aAttributes, source);    return NS_OK;}