Example usage for org.dom4j Element nodeIterator

List of usage examples for org.dom4j Element nodeIterator

Introduction

In this page you can find the example usage for org.dom4j Element nodeIterator.

Prototype

Iterator<Node> nodeIterator();

Source Link

Document

Returns an iterator through the content nodes of this branch

Usage

From source file:org.foxbpm.bpmn.converter.util.BpmnXMLUtil.java

License:Apache License

/**
 * ??//  w w  w  .j  a v  a2s .  c  o  m
 * 
 * @param element
 *            ?
 * @return ?
 */
@SuppressWarnings("rawtypes")
public static String parseExpression(Element element) {
    Node node = null;
    if (element == null) {
        return null;
    }
    for (Iterator iterator = element.nodeIterator(); iterator.hasNext();) {
        node = (Node) iterator.next();
        if (Element.CDATA_SECTION_NODE == node.getNodeType()) {
            return node.getText();
        }
    }
    return null;
}

From source file:org.jin.dic.data.pub.ldoce.v5.Convert2Html.java

License:Open Source License

private static void addChildren(Element s, Element d) {
    Element span = DocumentHelper.createElement("span");
    d.add(span);//ww w  .  ja  v a2 s .c  o m
    if (!s.getName().equalsIgnoreCase("base")) {
        String c;
        if (s.getName().equals("span")) {
            c = s.attributeValue("class");
            if (c == null || c.length() == 0) {
                c = null;
            } else {
                c = getClass(s);
            }
        } else {
            c = getClass(s);
        }
        if (c != null && c.length() > 0)
            span.addAttribute("class", c);
    }
    Iterator i = s.nodeIterator();
    Node node;
    while (i.hasNext()) {
        node = (Node) i.next();
        if (node instanceof Element)
            addChildren((Element) node, span);
        else
            span.add((Node) node.clone());
    }

}

From source file:org.jivesoftware.util.XMLProperties.java

License:Open Source License

/**
 * Sets a property to an array of values. Multiple values matching the same property
 * is mapped to an XML file as multiple elements containing each value.
 * For example, using the name "foo.bar.prop", and the value string array containing
 * {"some value", "other value", "last value"} would produce the following XML:
 * <pre>//from w ww.j  a  va  2 s . c om
 * &lt;foo&gt;
 *     &lt;bar&gt;
 *         &lt;prop&gt;some value&lt;/prop&gt;
 *         &lt;prop&gt;other value&lt;/prop&gt;
 *         &lt;prop&gt;last value&lt;/prop&gt;
 *     &lt;/bar&gt;
 * &lt;/foo&gt;
 * </pre>
 *
 * @param name the name of the property.
 * @param values the values for the property (can be empty but not null).
 */
public void setProperties(String name, List<String> values) {
    String[] propName = parsePropertyName(name);
    // Search for this property by traversing down the XML hierarchy,
    // stopping one short.
    Element element = document.getRootElement();
    for (int i = 0; i < propName.length - 1; i++) {
        // If we don't find this part of the property in the XML hierarchy
        // we add it as a new node
        if (element.element(propName[i]) == null) {
            element.addElement(propName[i]);
        }
        element = element.element(propName[i]);
    }
    String childName = propName[propName.length - 1];
    // We found matching property, clear all children.
    List<Element> toRemove = new ArrayList<Element>();
    Iterator<Element> iter = element.elementIterator(childName);
    while (iter.hasNext()) {
        toRemove.add(iter.next());
    }
    for (iter = toRemove.iterator(); iter.hasNext();) {
        element.remove((Element) iter.next());
    }
    // Add the new children.
    for (String value : values) {
        Element childElement = element.addElement(childName);
        if (value.startsWith("<![CDATA[")) {
            Iterator<Node> it = childElement.nodeIterator();
            while (it.hasNext()) {
                Node node = it.next();
                if (node instanceof CDATA) {
                    childElement.remove(node);
                    break;
                }
            }
            childElement.addCDATA(value.substring(9, value.length() - 3));
        } else {
            String propValue = StringEscapeUtils.escapeXml(value);
            // check to see if the property is marked as encrypted
            if (JiveGlobals.isPropertyEncrypted(name)) {
                propValue = JiveGlobals.getPropertyEncryptor().encrypt(value);
                childElement.addAttribute(ENCRYPTED_ATTRIBUTE, "true");
            }
            childElement.setText(propValue);
        }
    }
    saveProperties();

    // Generate event.
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("value", values);
    PropertyEventDispatcher.dispatchEvent(name, PropertyEventDispatcher.EventType.xml_property_set, params);
}

From source file:org.jivesoftware.util.XMLProperties.java

License:Open Source License

/**
 * Sets the value of the specified property. If the property doesn't
 * currently exist, it will be automatically created.
 *
 * @param name  the name of the property to set.
 * @param value the new value for the property.
 *///  w  w  w.ja v  a  2 s  . com
public synchronized void setProperty(String name, String value) {
    if (!StringEscapeUtils.escapeXml(name).equals(name)) {
        throw new IllegalArgumentException("Property name cannot contain XML entities.");
    }
    if (name == null) {
        return;
    }
    if (value == null) {
        value = "";
    }

    // Set cache correctly with prop name and value.
    propertyCache.put(name, value);

    String[] propName = parsePropertyName(name);
    // Search for this property by traversing down the XML hierarchy.
    Element element = document.getRootElement();
    for (String aPropName : propName) {
        // If we don't find this part of the property in the XML hierarchy
        // we add it as a new node
        if (element.element(aPropName) == null) {
            element.addElement(aPropName);
        }
        element = element.element(aPropName);
    }
    // Set the value of the property in this node.
    if (value.startsWith("<![CDATA[")) {
        Iterator it = element.nodeIterator();
        while (it.hasNext()) {
            Node node = (Node) it.next();
            if (node instanceof CDATA) {
                element.remove(node);
                break;
            }
        }
        element.addCDATA(value.substring(9, value.length() - 3));
    } else {
        String propValue = StringEscapeUtils.escapeXml(value);
        // check to see if the property is marked as encrypted
        if (JiveGlobals.isPropertyEncrypted(name)) {
            propValue = JiveGlobals.getPropertyEncryptor().encrypt(value);
            element.addAttribute(ENCRYPTED_ATTRIBUTE, "true");
        }
        element.setText(propValue);
    }
    // Write the XML properties to disk
    saveProperties();

    // Generate event.
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("value", value);
    PropertyEventDispatcher.dispatchEvent(name, PropertyEventDispatcher.EventType.xml_property_set, params);
}

From source file:org.opencms.importexport.CmsXmlPageConverter.java

License:Open Source License

/**
 * Converts the contents of a page into an xml page.<p>
 * //w  ww. jav a  2s  .c  om
 * @param cms the cms object
 * @param content the content used with xml templates
 * @param locale the locale of the body element(s)
 * @param encoding the encoding to the xml page
 * @return the xml page content or null if conversion failed
 * @throws CmsImportExportException if the body content or the XMLTEMPLATE element were not found
 * @throws CmsXmlException if there is an error reading xml contents from the byte array into a document
 */
public static CmsXmlPage convertToXmlPage(CmsObject cms, byte[] content, Locale locale, String encoding)
        throws CmsImportExportException, CmsXmlException {

    CmsXmlPage xmlPage = null;

    Document page = CmsXmlUtils.unmarshalHelper(content, null);

    Element xmltemplate = page.getRootElement();
    if ((xmltemplate == null) || !"XMLTEMPLATE".equals(xmltemplate.getName())) {
        throw new CmsImportExportException(Messages.get().container(Messages.ERR_NOT_FOUND_ELEM_XMLTEMPLATE_0));
    }

    // get all edittemplate nodes
    Iterator i = xmltemplate.elementIterator("edittemplate");
    boolean useEditTemplates = true;
    if (!i.hasNext()) {
        // no edittemplate nodes found, get the template nodes
        i = xmltemplate.elementIterator("TEMPLATE");
        useEditTemplates = false;
    }

    // now create the XML page
    xmlPage = new CmsXmlPage(locale, encoding);

    while (i.hasNext()) {
        Element currentTemplate = (Element) i.next();
        String bodyName = currentTemplate.attributeValue("name");
        if (CmsStringUtil.isEmpty(bodyName)) {
            // no template name found, use the parameter body name
            bodyName = "body";
        }
        String bodyContent = null;

        if (useEditTemplates) {
            // no content manipulation needed for edittemplates
            bodyContent = currentTemplate.getText();
        } else {
            // parse content for TEMPLATEs
            StringBuffer contentBuffer = new StringBuffer();
            for (Iterator k = currentTemplate.nodeIterator(); k.hasNext();) {
                Node n = (Node) k.next();
                if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
                    contentBuffer.append(n.getText());
                    continue;
                } else if (n.getNodeType() == Node.ELEMENT_NODE) {
                    if ("LINK".equals(n.getName())) {
                        contentBuffer.append(OpenCms.getSystemInfo().getOpenCmsContext());
                        contentBuffer.append(n.getText());
                        continue;
                    }
                }
            }
            bodyContent = contentBuffer.toString();
        }

        if (bodyContent == null) {
            throw new CmsImportExportException(Messages.get().container(Messages.ERR_BODY_CONTENT_NOT_FOUND_0));
        }

        bodyContent = CmsStringUtil.substitute(bodyContent, CmsStringUtil.MACRO_OPENCMS_CONTEXT,
                OpenCms.getSystemInfo().getOpenCmsContext());

        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(bodyContent)) {
            xmlPage.addValue(bodyName, locale);
            xmlPage.setStringValue(cms, bodyName, locale, bodyContent);
        }
    }

    return xmlPage;

}

From source file:org.springfield.fs.Fs.java

License:Open Source License

public static FsNode getNode(String path) {
    FsNode result = new FsNode();
    result.setPath(path);/*from  w w  w  .  ja  va 2s .co m*/
    path += "/properties";
    String xml = "<fsxml><properties><depth>0</depth></properties></fsxml>";

    ServiceInterface smithers = ServiceManager.getService("smithers");
    if (smithers == null) {
        System.out.println("org.springfield.fs.Fs : service not found smithers");
        return null;
    }
    String node = smithers.get(path, xml, "text/xml");

    if (node.indexOf("<error id=\"404\">") != -1) {
        return null; // node not found
    }
    try {
        Document doc = DocumentHelper.parseText(node);
        for (Iterator<Node> iter = doc.getRootElement().nodeIterator(); iter.hasNext();) {
            Element p = (Element) iter.next();
            result.setName(p.getName());
            result.setId(p.attribute("id").getText());
            if (p.attribute("referid") != null) {
                String referid = p.attribute("referid").getText();
                if (referid != null)
                    result.setReferid(referid);
            }
            for (Iterator<Node> iter2 = p.nodeIterator(); iter2.hasNext();) {
                Element p2 = (Element) iter2.next();
                if (p2.getName().equals("properties")) {
                    for (Iterator<Node> iter3 = p2.nodeIterator(); iter3.hasNext();) {
                        Object p3 = iter3.next();
                        if (p3 instanceof Element) {
                            String pname = ((Element) p3).getName();
                            String pvalue = ((Element) p3).getText();
                            if (pvalue.indexOf("Solistai Laima") != -1) {
                                System.out.println("D1=" + pvalue);
                                System.out.println("D2=" + FsEncoding.decode(pvalue));
                            }
                            result.setProperty(pname, FsEncoding.decode(pvalue));
                        } else {

                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}

From source file:org.springfield.fs.Fs.java

License:Open Source License

public static List<FsNode> getNodes(String path, int depth) {
    List<FsNode> result = new ArrayList<FsNode>();
    String xml = "<fsxml><properties><depth>" + depth + "</depth></properties></fsxml>";

    String nodes = "";

    ServiceInterface smithers = ServiceManager.getService("smithers");
    if (smithers == null) {
        System.out.println("org.springfield.fs.Fs : service not found smithers");
        return null;
    }//w w  w . j  av  a  2  s. c o  m
    nodes = smithers.get(path, xml, "text/xml");
    path = path.substring(path.indexOf("/domain/"));

    if (nodes.indexOf("<error id=\"404\">") != -1) {
        return null; // node not found
    }

    LOG.debug("nodes " + nodes);

    try {
        Document doc = DocumentHelper.parseText(nodes);

        if (isMainNode(path)) {
            for (Iterator<Node> iter = doc.getRootElement().nodeIterator(); iter.hasNext();) {
                Element node = (Element) iter.next();
                FsNode nn = new FsNode();
                if (!node.getName().equals("properties")) {
                    nn.setName(node.getName());
                    nn.setId(node.attribute("id").getText());
                    nn.setPath(path + "/" + nn.getName() + "/" + nn.getId());
                    if (node.attribute("referid") != null) {
                        String referid = node.attribute("referid").getText();
                        if (referid != null)
                            nn.setReferid(referid);
                    }
                    result.add(nn);
                    for (Iterator<Node> iter2 = node.nodeIterator(); iter2.hasNext();) {
                        Element p2 = (Element) iter2.next();
                        if (p2.getName().equals("properties")) {
                            for (Iterator<Node> iter3 = p2.nodeIterator(); iter3.hasNext();) {
                                Object o = iter3.next();
                                if (o instanceof Element) {
                                    Element p3 = (Element) o;
                                    String pname = p3.getName();
                                    String pvalue = p3.getText();
                                    nn.setProperty(pname, FsEncoding.decode(pvalue));
                                }
                            }
                        }
                    }
                }
            }
        } else {
            //System.out.println("IS SUBNODE");
            for (Iterator<Node> iter = doc.getRootElement().nodeIterator(); iter.hasNext();) {
                Element node = (Element) iter.next();
                for (Iterator<Node> iter2 = node.nodeIterator(); iter2.hasNext();) {
                    Element node2 = (Element) iter2.next();
                    FsNode nn = new FsNode();
                    if (!node2.getName().equals("properties")) {
                        nn.setName(node2.getName());
                        nn.setId(node2.attribute("id").getText());
                        nn.setPath(path + "/" + nn.getName() + "/" + nn.getId());
                        for (Iterator<Node> iter3 = node2.nodeIterator(); iter3.hasNext();) {
                            Element p2 = (Element) iter3.next();
                            if (p2.getName().equals("properties")) {
                                for (Iterator<Node> iter4 = p2.nodeIterator(); iter4.hasNext();) {
                                    Object o = iter4.next();
                                    if (o instanceof Element) {
                                        Element p3 = (Element) o;
                                        String pname = p3.getName();
                                        String pvalue = p3.getText();
                                        if (pvalue.indexOf("Solistai Laima") != -1) {
                                            System.out.println("D1=" + pvalue);
                                            System.out.println("D2=" + FsEncoding.decode(pvalue));
                                        }
                                        nn.setProperty(pname, FsEncoding.decode(pvalue));
                                    }
                                }
                            }
                        }
                        result.add(nn);
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return result;
}

From source file:org.springfield.fs.FSListManager.java

License:Open Source License

public static List<FsNode> getNodes(String path, int depth, int start, int limit) {
    //System.out.println("T="+new Date().getTime());
    List<FsNode> result = new ArrayList<FsNode>();
    String limitStr = "";
    if (limit > 0) {
        limitStr = "<limit>" + limit + "</limit>";
    }/* w w  w .  j ava  2s  .c  o  m*/
    String xml = "<fsxml><properties><start>" + start + "</start>" + limitStr + "<depth>" + depth
            + "</depth></properties></fsxml>";

    String nodes = "";
    if (path.indexOf("http://") == -1) {
        //danielfix         nodes = LazyHomer.sendRequestBart("GET",path,xml,"text/xml");
        ServiceInterface smithers = ServiceManager.getService("smithers");
        if (smithers == null) {
            System.out.println("org.springfield.fs.FSListManager : service not found smithers");
            return null;
        }
        //System.out.println("GET MEM="+path);
        nodes = smithers.get(path, xml, "text/xml");
        if (nodes != null) {
            //System.out.println("NODES MEMORY SIZE="+nodes.length()+" PATH="+path);
        } else {
            System.out.println("EMPTY GET ON=" + path);
        }

    } else {
        nodes = HttpHelper.sendRequest("GET", path, "text/xml", "text/xml").toString();
        path = path.substring(path.indexOf("/domain/"));
    }
    try {

        Document doc = DocumentHelper.parseText(nodes);

        if (isMainNode(path)) {
            for (Iterator<Node> iter = doc.getRootElement().nodeIterator(); iter.hasNext();) {
                Element node = (Element) iter.next();
                FsNode nn = new FsNode();
                if (!node.getName().equals("properties")) {
                    nn.setName(node.getName());
                    nn.setId(node.attribute("id").getText());
                    nn.setPath(path + "/" + nn.getId());
                    if (node.attribute("referid") != null) {
                        nn.setReferid(node.attribute("referid").getText());
                    }
                    result.add(nn);
                    for (Iterator<Node> iter3 = node.nodeIterator(); iter3.hasNext();) {
                        Element p2 = (Element) iter3.next();
                        if (p2.getName().equals("properties")) {
                            for (Iterator<Node> iter4 = p2.nodeIterator(); iter4.hasNext();) {
                                Object o = iter4.next();
                                if (o instanceof Element) {
                                    Element p3 = (Element) o;
                                    String pname = p3.getName();
                                    String pvalue = p3.getText();
                                    //System.out.println("NODE NAME="+pname+" "+pvalue);
                                    nn.setProperty(pname, FsEncoding.decode(pvalue));
                                }
                            }
                        }
                    }

                } else { // so this is the property node
                }
            }
        } else {
            for (Iterator<Node> iter = doc.getRootElement().nodeIterator(); iter.hasNext();) {
                Element node = (Element) iter.next();
                for (Iterator<Node> iter2 = node.nodeIterator(); iter2.hasNext();) {
                    Element node2 = (Element) iter2.next();
                    FsNode nn = new FsNode();
                    if (!node2.getName().equals("properties")) {
                        //System.out.println("NAME2="+node2.getName());
                        nn.setName(node2.getName());
                        nn.setId(node2.attribute("id").getText());
                        nn.setPath(path + "/" + nn.getName() + "/" + nn.getId());
                        if (node.attribute("referid") != null) {
                            nn.setReferid(node.attribute("referid").getText());
                        }
                        result.add(nn);
                        for (Iterator<Node> iter3 = node2.nodeIterator(); iter3.hasNext();) {
                            Element p2 = (Element) iter3.next();
                            if (p2.getName().equals("properties")) {
                                for (Iterator<Node> iter4 = p2.nodeIterator(); iter4.hasNext();) {
                                    Object o = iter4.next();
                                    if (o instanceof Element) {
                                        Element p3 = (Element) o;
                                        String pname = p3.getName();
                                        String pvalue = p3.getText();
                                        nn.setProperty(pname, FsEncoding.decode(pvalue));
                                    }
                                }
                            }
                        }

                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    //System.out.println("T2="+new Date().getTime());
    return result;
}

From source file:org.springfield.fs.FsNode.java

License:Open Source License

public static FsNode parseFsNode(String fsxml) {
    try {/*w ww.  j ava2 s  . c o m*/
        FsNode newnode = new FsNode();
        Document doc = DocumentHelper.parseText(fsxml);
        if (doc != null) {
            Element rootnode = doc.getRootElement();
            String name = rootnode.getName();
            String id = rootnode.attributeValue("id");
            //System.out.println("PARSE NODE NAME="+name+" ID="+id);   
            newnode.setName(name);
            newnode.setId(id);
            for (Iterator<Node> iter = doc.getRootElement().nodeIterator(); iter.hasNext();) {
                Element node = (Element) iter.next();
                //System.out.print("NAME="+node.getName());
                if (node.getName().equals("properties")) {
                    for (Iterator<Node> iter2 = node.nodeIterator(); iter2.hasNext();) {
                        Node node2 = iter2.next();
                        if (node2 instanceof Element) {
                            Element child2 = (Element) node2;
                            String pname = child2.getName();
                            String pvalue = child2.getText();
                            newnode.setProperty(pname, pvalue);
                            //System.out.println("PARSED NODE PNAME="+pname+" PVALUE="+pvalue);   
                        }
                    }
                }
            }
        }
        return newnode;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:org.springfield.lou.application.ApplicationManager.java

License:Open Source License

public void loadAvailableApps() {
    //System.out.println("ApplicationManager.loadAvailableApps()");
    availableapps = new HashMap<String, Html5AvailableApplication>();
    String xml = "<fsxml><properties><depth>2</depth></properties></fsxml>";
    long starttime = new Date().getTime(); // we track the request time for debugging only
    ServiceInterface smithers = ServiceManager.getService("smithers");
    if (smithers == null)
        return;/*  w w w .  j a  v a2s.  c  om*/

    String nodes = smithers.get("/domain/internal/service/lou/apps", xml, "text/xml");
    //System.out.println("APP NODECOUNT="+nodes.length());
    long endtime = new Date().getTime(); // we track the request time for debugging only
    //System.out.println("SMITHERSTIME="+(endtime-starttime));
    try {
        Document result = DocumentHelper.parseText(nodes);
        for (Iterator<Node> iter = result.getRootElement().nodeIterator(); iter.hasNext();) {
            Element child = (Element) iter.next();
            if (!child.getName().equals("properties")) {
                String id = child.attributeValue("id");
                Html5AvailableApplication vapp = new Html5AvailableApplication();
                vapp.setId(id);

                // get all the versions and nodes
                String production = null;
                String development = null;
                for (Iterator<Node> iter2 = child.nodeIterator(); iter2.hasNext();) {
                    //System.out.println("N2");
                    Node node = iter2.next();
                    if (node instanceof Element) {
                        Element child2 = (Element) node;
                        String nname = child2.getName();
                        if (nname.equals("properties")) {
                            //System.out.println("N3");
                            for (Iterator<Node> iter3 = child2.nodeIterator(); iter3.hasNext();) {
                                Node node2 = iter3.next();
                                if (node2 instanceof Element) {
                                    //System.out.println("N4");
                                    Element child3 = (Element) node2;
                                    String pname = child3.getName();
                                    if (pname.equals("autodeploy")) {
                                        vapp.loadAutoDeploy(child3.getText());
                                    }
                                }
                            }
                        } else if (nname.equals("versions")) {
                            //System.out.println("N5");
                            String version = child2.attributeValue("id");
                            Html5AvailableApplicationVersion v = new Html5AvailableApplicationVersion(vapp);
                            v.setId(version);
                            vapp.addVersion(v);
                            //System.out.println("N5.1");

                        } else if (nname.equals("nodes")) {
                            //System.out.println("N6");
                            String ipnumber = child2.attributeValue("id");
                            String ipversion = child2.attributeValue("referid");
                        } else if (nname.equals("production")) {
                            //System.out.println("N7");
                            production = child2.attributeValue("referid");
                        } else if (nname.equals("development")) {
                            //System.out.println("N7");
                            development = child2.attributeValue("referid");
                        }
                        //System.out.println("N5.2");
                        // ok lets set prod/dev version
                        if (production != null) {
                            Html5AvailableApplicationVersion pv = vapp.getVersionByUrl(production);
                            if (pv != null) {
                                pv.loadProductionState(true);
                                // lets scan for triggers !
                                String scanpath = "/springfield/lou/apps/" + vapp.getId() + "/" + pv.getId()
                                        + "/components/app.xml";
                                //System.out.println("ACTIONLIST PRESCANNER="+scanpath);
                                readJumpersForApp(scanpath);
                                //   if (!LazyHomer.inDeveloperMode()) ActionListManager.readActionListsDirForUrlTriggers(scanpath);
                            }
                        }
                        //System.out.println("N5.2");
                        if (development != null) {
                            Html5AvailableApplicationVersion dv = vapp.getVersionByUrl(development);
                            if (dv != null) {
                                dv.loadDevelopmentState(true);
                                String scanpath = "/springfield/lou/apps/" + vapp.getId() + "/" + dv.getId()
                                        + "/actionlists/";
                                //   if (LazyHomer.inDeveloperMode()) ActionListManager.readActionListsDirForUrlTriggers(scanpath);
                            }
                        }

                        //System.out.println("N5.3");
                    } else {
                        System.out.println("NOT AN ELEMENT!");
                        System.out.println(node);
                    }
                    //System.out.println("N99");
                }
                availableapps.put(id, vapp);

                // parse it again to get the nodes, don't like it but simplest way
                for (Iterator<Node> iter2 = child.nodeIterator(); iter2.hasNext();) {
                    Element child2 = (Element) iter2.next();
                    String nname = child2.getName();
                    if (nname.equals("nodes")) {
                        String ipnumber = child2.attributeValue("id");
                        String ipversion = child2.attributeValue("referid");
                        //System.out.println("IP="+ipnumber+" VER="+ipversion);
                        Html5AvailableApplicationVersion vv = vapp.getVersionByUrl(ipversion);
                        if (vv != null) {
                            vv.addNode(ipnumber);
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        System.out.println("Application manager : ");
        e.printStackTrace();
    }
    if (availableapps.size() == 0) {
        System.out.println("NO APPS FOUND RETURNING NULL");
        availableapps = null;
    }
    //System.out.println("END OF LOADAVAIL");
}