[Yanel-commits] rev 32475 - public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client

michi at wyona.com michi at wyona.com
Mon Feb 25 23:56:20 CET 2008


Author: michi
Date: 2008-02-25 23:56:19 +0100 (Mon, 25 Feb 2008)
New Revision: 32475

Modified:
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java
Log:
also parse world

Modified: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java	2008-02-25 22:51:28 UTC (rev 32474)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java	2008-02-25 22:56:19 UTC (rev 32475)
@@ -47,7 +47,7 @@
     public void onResponseReceived(final Request request, final Response response) {
         Element rootElement = XMLParser.parse(response.getText()).getDocumentElement();
         //Window.alert("Root element: " + rootElement.getTagName());
-        Element worldElement = null; //getFirstChildElement(rootElement, "world");
+        Element worldElement = getFirstChildElement(rootElement, "world");
         if (worldElement != null) {
             identities.add("WORLD (Read,Write)");
             Window.alert("World: " + (String) identities.elementAt(identities.size() - 1));
@@ -77,4 +77,16 @@
         ids[2] = "WORLD";
         return ids;
     }
+
+    /**
+     *
+     */
+    private Element getFirstChildElement(Element parent, String name) {
+        NodeList nl = parent.getElementsByTagName(name);
+        if (nl.getLength() > 0) {
+            return (Element) nl.item(0);
+        } else {
+            return null;
+        }
+    }
 }



More information about the Yanel-commits mailing list