rv = gRDFService->GetUnicodeResource(value, getter_AddRefs(resource));
rv = gRDFService->GetUnicodeResource(value.GetUnicode(), getter_AddRefs(resource));
nsXULTemplateBuilder::CompileSimpleRule(nsIContent* aRuleElement,                                        PRInt32 aPriority,                                        InnerNode* aParentNode){    // Compile a "simple" (or old-school style) <template> rule.    nsresult rv;    PRBool hasContainerTest = PR_FALSE;    PRUint32 count = aRuleElement->GetAttrCount();    // Add constraints for the LHS    for (PRUint32 i = 0; i < count; ++i) {        PRInt32 attrNameSpaceID;        nsCOMPtr<nsIAtom> attr, prefix;        rv = aRuleElement->GetAttrNameAt(i, &attrNameSpaceID,                                         getter_AddRefs(attr),                                         getter_AddRefs(prefix));        if (NS_FAILED(rv)) return rv;        // Note: some attributes must be skipped on XUL template rule subtree        // never compare against rdf:property attribute        if ((attr.get() == nsXULAtoms::property) && (attrNameSpaceID == kNameSpaceID_RDF))            continue;        // never compare against rdf:instanceOf attribute        else if ((attr.get() == nsXULAtoms::instanceOf) && (attrNameSpaceID == kNameSpaceID_RDF))            continue;        // never compare against {}:id attribute        else if ((attr.get() == nsXULAtoms::id) && (attrNameSpaceID == kNameSpaceID_None))            continue;        else if ((attr.get() == nsXULAtoms::parsetype) && (attrNameSpaceID == kNameSpaceID_None))            continue;        nsAutoString value;        rv = aRuleElement->GetAttr(attrNameSpaceID, attr, value);        if (NS_FAILED(rv)) return rv;        TestNode* testnode = nsnull;        if (CompileSimpleAttributeCondition(attrNameSpaceID, attr, value, aParentNode, &testnode)) {            // handled by subclass        }        else if (((attrNameSpaceID == kNameSpaceID_None) && (attr.get() == nsXULAtoms::iscontainer)) ||                 ((attrNameSpaceID == kNameSpaceID_None) && (attr.get() == nsXULAtoms::isempty))) {            // Tests about containerhood and emptiness. These can be            // globbed together, mostly. Check to see if we've already            // added a container test: we only need one.            if (hasContainerTest)                continue;            nsRDFConInstanceTestNode::Test iscontainer =                nsRDFConInstanceTestNode::eDontCare;            rv = aRuleElement->GetAttr(kNameSpaceID_None, nsXULAtoms::iscontainer, value);            if (NS_FAILED(rv)) return rv;            if (rv == NS_CONTENT_ATTR_HAS_VALUE) {                if (value.EqualsLiteral("true")) {                    iscontainer = nsRDFConInstanceTestNode::eTrue;                }                else if (value.EqualsLiteral("false")) {                    iscontainer = nsRDFConInstanceTestNode::eFalse;                }            }            nsRDFConInstanceTestNode::Test isempty =                nsRDFConInstanceTestNode::eDontCare;            rv = aRuleElement->GetAttr(kNameSpaceID_None, nsXULAtoms::isempty, value);            if (NS_FAILED(rv)) return rv;            if (rv == NS_CONTENT_ATTR_HAS_VALUE) {                if (value.EqualsLiteral("true")) {                    isempty = nsRDFConInstanceTestNode::eTrue;                }                else if (value.EqualsLiteral("false")) {                    isempty = nsRDFConInstanceTestNode::eFalse;                }            }            testnode = new nsRDFConInstanceTestNode(aParentNode,                                                    mConflictSet,                                                    mDB,                                                    mContainmentProperties,                                                    mMemberVar,                                                    iscontainer,                                                    isempty);            if (! testnode)                return NS_ERROR_OUT_OF_MEMORY;            mRDFTests.Add(testnode);        }        else {            // It's a simple RDF test            nsCOMPtr<nsIRDFResource> property;            rv = nsXULContentUtils::GetResource(attrNameSpaceID, attr, getter_AddRefs(property));            if (NS_FAILED(rv)) return rv;            // XXXwaterson this is so manky            nsCOMPtr<nsIRDFNode> target;            if (value.FindChar(':') != -1) { // XXXwaterson WRONG WRONG WRONG!                nsCOMPtr<nsIRDFResource> resource;                rv = gRDFService->GetUnicodeResource(value, getter_AddRefs(resource));                if (NS_FAILED(rv)) return rv;                target = do_QueryInterface(resource);            }            else {                              nsAutoString parseType;              aRuleElement->GetAttr(kNameSpaceID_None, nsXULAtoms::parsetype, parseType);              rv = ParseLiteral(parseType, value, getter_AddRefs(target));              if (NS_FAILED(rv))                  return rv;            }            testnode = new nsRDFPropertyTestNode(aParentNode, mConflictSet, mDB, mMemberVar, property, target);            if (! testnode)                return NS_ERROR_OUT_OF_MEMORY;            mRDFTests.Add(testnode);        }        aParentNode->AddChild(testnode);        mRules.AddNode(testnode);        aParentNode = testnode;    }    // Create the rule.    nsTemplateRule* rule = new nsTemplateRule(mDB, aRuleElement, aPriority);    if (! rule)        return NS_ERROR_OUT_OF_MEMORY;    rule->SetContainerVariable(mContainerVar);    rule->SetMemberVariable(mMemberVar);    AddSimpleRuleBindings(rule, aRuleElement);    // The InstantiationNode owns the rule now.    nsInstantiationNode* instnode =        new nsInstantiationNode(mConflictSet, rule, mDB);    if (! instnode)        return NS_ERROR_OUT_OF_MEMORY;    aParentNode->AddChild(instnode);    mRules.AddNode(instnode);        return NS_OK;}