value.StripChar('\n'); value.StripChar('\r');
value.StripChar(PRUnichar('\n')); value.StripChar(PRUnichar('\r'));
PRBool PR_CALLBACK SetAttrs(nsHashKey* aKey, void* aData, void* aClosure){  // XXX How to deal with NAMESPACES!!!?  nsIXBLAttributeEntry* entry = (nsIXBLAttributeEntry*)aData;  nsXBLAttrChangeData* changeData = (nsXBLAttrChangeData*)aClosure;  nsCOMPtr<nsIAtom> src;  entry->GetSrcAttribute(getter_AddRefs(src));  nsAutoString value;  PRBool attrPresent = PR_TRUE;  if (src == nsXBLAtoms::xbltext) {    nsXBLBinding::GetTextData(changeData->mBoundElement, value);    value.StripChar('\n');    value.StripChar('\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;    changeData->mProto->GetImmediateChild(nsXBLAtoms::content, getter_AddRefs(content));    nsCOMPtr<nsIXBLAttributeEntry> curr = entry;    while (curr) {      nsCOMPtr<nsIAtom> dst;      nsCOMPtr<nsIContent> element;      curr->GetDstAttribute(getter_AddRefs(dst));      curr->GetElement(getter_AddRefs(element));      nsCOMPtr<nsIContent> realElement;      changeData->mProto->LocateInstance(changeData->mBoundElement,                                         content, changeData->mContent, element, getter_AddRefs(realElement));      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<nsIDocument> doc;          changeData->mBoundElement->GetDocument(*getter_AddRefs(doc));          nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(doc));          domDoc->CreateTextNode(value, getter_AddRefs(textNode));          nsCOMPtr<nsIDOMNode> dummy;          nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(realElement));          domElement->AppendChild(textNode, getter_AddRefs(dummy));        }      }      nsCOMPtr<nsIXBLAttributeEntry> next = curr;      curr->GetNext(getter_AddRefs(next));      curr = next;    }  }  return PR_TRUE;}