nsCOMPtr<nsIDOMDocument> domDoc( do_QueryInterface(changeData->mBoundElement->GetDocument()));
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(changeData->mBoundElement->GetDocument());
PRBool PR_CALLBACK SetAttrs(nsHashKey* aKey, void* aData, void* aClosure){  // XXX How to deal with NAMESPACES!!!?  nsXBLAttributeEntry* entry = NS_STATIC_CAST(nsXBLAttributeEntry*, aData);  nsXBLAttrChangeData* changeData = NS_STATIC_CAST(nsXBLAttrChangeData*, aClosure);  nsIAtom* src = entry->GetSrcAttribute();  nsAutoString value;  PRBool attrPresent = PR_TRUE;  if (src == nsXBLAtoms::xbltext) {    nsXBLBinding::GetTextData(changeData->mBoundElement, value);    value.StripChar(PRUnichar('\n'));    value.StripChar(PRUnichar('\r'));    nsAutoString stripVal(value);    stripVal.StripWhitespace();    if (stripVal.IsEmpty())       attrPresent = PR_FALSE;  }  else {    nsresult result = changeData->mBoundElement->GetAttr(kNameSpaceID_None, src, value);    attrPresent = (result == NS_CONTENT_ATTR_NO_VALUE ||                   result == NS_CONTENT_ATTR_HAS_VALUE);  }  if (attrPresent) {    nsCOMPtr<nsIContent> content;    content = changeData->mProto->GetImmediateChild(nsXBLAtoms::content);    nsXBLAttributeEntry* curr = entry;    while (curr) {      nsIAtom* dst = curr->GetDstAttribute();      nsIContent* element = curr->GetElement();      nsCOMPtr<nsIContent> realElement;      realElement = changeData->mProto->LocateInstance(changeData->mBoundElement,                                                       content,                                                       changeData->mContent,                                                       element);      if (realElement) {        realElement->SetAttr(kNameSpaceID_None, dst, value, PR_FALSE);        nsCOMPtr<nsIAtom> tag;        realElement->GetTag(getter_AddRefs(tag));        if (dst == nsXBLAtoms::xbltext ||            (tag == nsHTMLAtoms::html) && (dst == nsHTMLAtoms::value) && !value.IsEmpty()) {          nsCOMPtr<nsIDOMText> textNode;          nsCOMPtr<nsIDOMDocument> domDoc(                  do_QueryInterface(changeData->mBoundElement->GetDocument()));          domDoc->CreateTextNode(value, getter_AddRefs(textNode));          nsCOMPtr<nsIDOMNode> dummy;          nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(realElement));          domElement->AppendChild(textNode, getter_AddRefs(dummy));        }      }      curr = curr->GetNext();    }  }  return PR_TRUE;}