if (NS_FAILED(rv)) aNameSpaceID = kNameSpaceID_None;
if (NS_FAILED(rv)) return rv;
XULDocumentImpl::ParseTagString(const nsString& aTagName, nsIAtom*& aName, PRInt32& aNameSpaceID){    // Parse the tag into a name and a namespace ID. This is slightly    // different than nsIContent::ParseAttributeString() because we    // take the default namespace into account (rather than just    // assigning "no namespace") in the case that there is no    // namespace prefix present.static char kNameSpaceSeparator[] = ":";    // XXX this is a gross hack, but it'll carry us for now. We parse    // the tag name using the root content, which presumably has all    // the namespace info we need.    NS_PRECONDITION(mRootContent != nsnull, "not initialized");    if (! mRootContent)        return NS_ERROR_NOT_INITIALIZED;    nsCOMPtr<nsIXMLContent> xml( do_QueryInterface(mRootContent) );    if (! xml) return NS_ERROR_UNEXPECTED;        nsresult rv;    nsCOMPtr<nsINameSpace> ns;    rv = xml->GetContainingNameSpace(*getter_AddRefs(ns));    if (NS_FAILED(rv)) return rv;    NS_ASSERTION(ns != nsnull, "expected xml namespace info to be available");    if (! ns)        return NS_ERROR_UNEXPECTED;    nsAutoString prefix;    nsAutoString name(aTagName);    PRInt32 nsoffset = name.Find(kNameSpaceSeparator);    if (-1 != nsoffset) {        name.Left(prefix, nsoffset);        name.Cut(0, nsoffset+1);    }    // Figure out the namespace ID    nsCOMPtr<nsIAtom> nameSpaceAtom;    if (0 < prefix.Length())        nameSpaceAtom = getter_AddRefs(NS_NewAtom(prefix));    rv = ns->FindNameSpaceID(nameSpaceAtom, aNameSpaceID);    if (NS_FAILED(rv))        aNameSpaceID = kNameSpaceID_None;    aName = NS_NewAtom(name);    return NS_OK;}