rv = mDataSource->GetTarget(rdfResource, property, PR_TRUE, getter_AddRefs(positionValue));
rv = mDataSource->GetTarget(rdfResource, kPosition, PR_TRUE, getter_AddRefs(positionValue));
XULContentSinkImpl::OpenTag(const nsIParserNode& aNode){    // an "object" non-terminal is a "container".  Change the content sink's    // state appropriately.    nsAutoString tag;    PRInt32 nameSpaceID;    SplitQualifiedName(aNode.GetText(), nameSpaceID, tag);    // HTML tags must be lowercase    if (nameSpaceID == kNameSpaceID_HTML) {        if (tag.Equals("script")) {            return OpenScript(aNode);        }    }    // Figure out the URI of this object, and create an RDF node for it.    nsresult rv;    nsCOMPtr<nsIRDFResource> rdfResource;    if (NS_FAILED(rv = GetXULIDAttribute(aNode, getter_AddRefs(rdfResource)))) {        NS_ERROR("unable to parser XUL ID from tag");        return rv;    }    NS_WITH_SERVICE(nsIRDFContainerUtils, rdfc, kRDFContainerUtilsCID, &rv);    if (NS_FAILED(rv)) return rv;    rv = rdfc->MakeSeq(mDataSource, rdfResource, nsnull);    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create sequence for tag");    if (NS_FAILED(rv)) return rv;    rv = mDataSource->Assert(rdfResource, kRDF_instanceOf, kXUL_element, PR_TRUE);    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to mark resource as XUL element");    if (NS_FAILED(rv)) return rv;    // Convert the container's namespace/tag pair to a fully qualified    // URI so that we can specify it as an RDF resource.    nsCOMPtr<nsIRDFResource> tagResource;    rv = nsRDFContentUtils::GetResource(nameSpaceID, tag, getter_AddRefs(tagResource));    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to construct resource from namespace/tag pair");    if (NS_FAILED(rv)) return rv;    rv = mDataSource->Assert(rdfResource, kXUL_tag, tagResource, PR_TRUE);    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to assert tag type");    if (NS_FAILED(rv)) return rv;    // Make arcs from us to all of our attribute values (with the attribute names    // as the labels of the arcs).    if (NS_FAILED(rv = AddAttributes(aNode, rdfResource))) {        NS_ERROR("problem adding properties to node");        return rv;    }    if (!mHaveSetRootResource) {        // This code sets the root (happens if we're the first open        // container).        mHaveSetRootResource = PR_TRUE;		    if (!mParentContentSink) {            nsCOMPtr<nsIRDFDocument> rdfDoc;            if (NS_SUCCEEDED(mDocument->QueryInterface(nsIRDFDocument::GetIID(),                                                       (void**) getter_AddRefs(rdfDoc)))) {                if (NS_FAILED(rv = rdfDoc->SetRootResource(rdfResource))) {                    NS_ERROR("couldn't set root resource");                    return rv;                }            }        }    }    else {        // We now have an RDF node for the container.  Hook it up to        // its parent container with a "child" relationship.        nsCOMPtr<nsIRDFContainer> container;        rv = NS_NewRDFContainer(mDataSource, GetTopResource(), getter_AddRefs(container));        if (NS_FAILED(rv)) return rv;        // Find out if a position is specified.  If so, we use that as the arc        // label instead of appending the object to the end.        // Add the attribute to RDF        nsCOMPtr<nsIRDFResource> property;        nsAutoString attr("#position");                rv = gRDFService->GetUnicodeResource(attr.GetUnicode(), getter_AddRefs(property));        if (NS_FAILED(rv)) return rv;        nsCOMPtr<nsIRDFNode> positionValue;        rv = mDataSource->GetTarget(rdfResource, property, PR_TRUE, getter_AddRefs(positionValue));        if (NS_FAILED(rv)) return rv;        if (positionValue) {           nsCOMPtr<nsIRDFLiteral> positionLiteral = do_QueryInterface(positionValue);          if (positionLiteral) {            // Retrieve the value that represents the position.            const PRUnichar* valueStr;            positionLiteral->GetValueConst(&valueStr);            nsCOMPtr<nsIRDFResource> posResource;            nsAutoString posStr(valueStr);            nsAutoString nextValStr = kRDFNameSpaceURI;            nextValStr.Append("_");            nextValStr.Append(posStr, 10);            rv = gRDFService->GetUnicodeResource(nextValStr.GetUnicode(), getter_AddRefs(posResource));            if (NS_FAILED(rv)) return rv;            rv = mDataSource->Assert(GetTopResource(), posResource, rdfResource, PR_TRUE);          }          else rv = container->AppendElement(rdfResource);        }        else {          // XXX We could be an overlay node indicating a removal.  If so, then we          // want to find the original assertion that linked us to the parent          // and perform a removal.          // Otherwise we're just a normal child and should be appended just like anyone          // else.          rv = container->AppendElement(rdfResource);        }        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add child to container");        if (NS_FAILED(rv)) return rv;    }    // Push the element onto the context stack, so that child    // containers will hook up to us as their parent.    PushResourceAndState(rdfResource, mState);    mState = eXULContentSinkState_InDocumentElement;    return NS_OK;}