From 1f97c263f8abe30c07bfcc3d9de3484c256b0152 Mon Sep 17 00:00:00 2001
From: "waterson%netscape.com" <waterson%netscape.com>
Date: Wed, 17 Feb 1999 11:56:44 +0000
Subject: [PATCH] Implemented nsIDOMElement::GetAttribute().

---
 content/xul/content/src/nsXULElement.cpp | 14 ++++++++++++--
 rdf/content/src/nsRDFElement.cpp         | 14 ++++++++++++--
 rdf/content/src/nsXULElement.cpp         | 14 ++++++++++++--
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp
index ae246577dfe2f..673cbbb905de7 100644
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -710,8 +710,18 @@ RDFElementImpl::GetTagName(nsString& aTagName)
 NS_IMETHODIMP
 RDFElementImpl::GetAttribute(const nsString& aName, nsString& aReturn)
 {
-    NS_NOTYETIMPLEMENTED("write me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
+    nsresult rv;
+    PRInt32 nameSpaceID;
+    nsIAtom* nameAtom;
+
+    if (NS_FAILED(rv = ParseAttributeString(aName, nameAtom, nameSpaceID))) {
+        NS_WARNING("unable to parse attribute name");
+        return rv;
+    }
+
+    GetAttribute(nameSpaceID, nameAtom, aReturn);
+    NS_RELEASE(nameAtom);
+    return NS_OK;
 }
 
 
diff --git a/rdf/content/src/nsRDFElement.cpp b/rdf/content/src/nsRDFElement.cpp
index ae246577dfe2f..673cbbb905de7 100644
--- a/rdf/content/src/nsRDFElement.cpp
+++ b/rdf/content/src/nsRDFElement.cpp
@@ -710,8 +710,18 @@ RDFElementImpl::GetTagName(nsString& aTagName)
 NS_IMETHODIMP
 RDFElementImpl::GetAttribute(const nsString& aName, nsString& aReturn)
 {
-    NS_NOTYETIMPLEMENTED("write me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
+    nsresult rv;
+    PRInt32 nameSpaceID;
+    nsIAtom* nameAtom;
+
+    if (NS_FAILED(rv = ParseAttributeString(aName, nameAtom, nameSpaceID))) {
+        NS_WARNING("unable to parse attribute name");
+        return rv;
+    }
+
+    GetAttribute(nameSpaceID, nameAtom, aReturn);
+    NS_RELEASE(nameAtom);
+    return NS_OK;
 }
 
 
diff --git a/rdf/content/src/nsXULElement.cpp b/rdf/content/src/nsXULElement.cpp
index ae246577dfe2f..673cbbb905de7 100644
--- a/rdf/content/src/nsXULElement.cpp
+++ b/rdf/content/src/nsXULElement.cpp
@@ -710,8 +710,18 @@ RDFElementImpl::GetTagName(nsString& aTagName)
 NS_IMETHODIMP
 RDFElementImpl::GetAttribute(const nsString& aName, nsString& aReturn)
 {
-    NS_NOTYETIMPLEMENTED("write me!");
-    return NS_ERROR_NOT_IMPLEMENTED;
+    nsresult rv;
+    PRInt32 nameSpaceID;
+    nsIAtom* nameAtom;
+
+    if (NS_FAILED(rv = ParseAttributeString(aName, nameAtom, nameSpaceID))) {
+        NS_WARNING("unable to parse attribute name");
+        return rv;
+    }
+
+    GetAttribute(nameSpaceID, nameAtom, aReturn);
+    NS_RELEASE(nameAtom);
+    return NS_OK;
 }
 
 
-- 
GitLab