Package com.google.gwt.xml.client

Examples of com.google.gwt.xml.client.NodeList


    Node node = list.item(idx);
    if (node.getNodeType() != Node.ELEMENT_NODE) {
      return null;
    }
    String ret = "";
    NodeList textNodes = node.getChildNodes();
    for (int i = 0; i < textNodes.getLength(); i++) {
      Node n = textNodes.item(i);
      if (n.getNodeType() == Node.TEXT_NODE && n.getNodeValue().replaceAll("[ \\n\\t\\r]", "").length() > 0) {
        ret += n.getNodeValue();
      } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
        ret += n.getNodeValue();
      }
View Full Code Here


    public static String getXmlNodeValue(Node node) {
      if (node.getNodeType() != Node.ELEMENT_NODE) {
        return null;
      }
      String ret = "";
      NodeList textNodes = node.getChildNodes();
      for (int i = 0; i < textNodes.getLength(); i++) {
        Node n = textNodes.item(i);
        if (n.getNodeType() == Node.TEXT_NODE && n.getNodeValue().replaceAll("[ \\n\\t\\r]", "").length() > 0) {
          ret += n.getNodeValue();
        } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) {
          ret += n.getNodeValue();
        }
View Full Code Here

     * @return a list of task definition references.
     */
    public List<TaskRef> readTasks(String responseText) {
        Document xml = XMLParser.parse(responseText);
        List<TaskRef> retval = null;
        NodeList list = xml.getElementsByTagName("task");
        if (list != null) {
            retval = new ArrayList<TaskRef>(list.getLength());
            for (int index = 0; index < list.getLength(); index++) {
                Element elem = (Element) list.item(index);
                TaskRef ref = new TaskRef();
                ref.setProcessId(elem.getAttribute("processId"));
                ref.setTaskId(elem.getAttribute("taskName"));
                ref.setInputs(extractTaskIO(elem.getElementsByTagName("input")));
                ref.setOutputs(extractTaskIO(elem.getElementsByTagName("output")));
                NodeList mdList = elem.getElementsByTagName("metaData");
                if (mdList != null) {
                    Map<String, String> metaData = new HashMap<String, String>();
                    for (int i = 0; i < mdList.getLength(); i++) {
                        Element mdElem = (Element) mdList.item(i);
                        metaData.put(mdElem.getAttribute("key"), mdElem.getAttribute("value"));
                    }
                    ref.setMetaData(metaData);
                }
                retval.add(ref);
View Full Code Here

     * @param responseText The XML response.
     * @return a list of menuOptions.
     */
    public List<MainMenuOption> readMenuOptions(String responseText) {
        Document xml = XMLParser.parse(responseText);
        NodeList menuOptions = xml.getElementsByTagName("menuOptions").item(0).getChildNodes();
        return readMenuOptions(menuOptions);
    }
View Full Code Here

     * @param responseText the XML response.
     * @return a list of FormRepresentation items.
     */
    public List<FormRepresentation> readForms(String responseText) {
        Document xml = XMLParser.parse(responseText);
        NodeList list = xml.getElementsByTagName("json");
        List<FormRepresentation> retval = new ArrayList<FormRepresentation>();
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        if (list != null) {
            for (int index = 0; index < list.getLength(); index++) {
                Node node = list.item(index);
                String json = getText(node);
                try {
                    FormRepresentation form = decoder.decode(json);
                    retval.add(form);
                } catch (FormEncodingException e) {
View Full Code Here

     * @return a map of lists of FBMenuItem instances.
     */
    public Map<String, List<FBMenuItem>> readMenuMap(String responseText) {
        Document xml = XMLParser.parse(responseText);
        Map<String, List<FBMenuItem>> menuItems = new HashMap<String, List<FBMenuItem>>();
        NodeList groups = xml.getElementsByTagName("menuGroup");
        for (int index = 0; index < groups.getLength(); index++) {
            Node groupNode = groups.item(index);
            String groupName = ((Element) groupNode).getAttribute("name");
            NodeList items = ((Element) groupNode).getElementsByTagName("menuItem");
            menuItems.put(groupName, readMenuItems(items, groupName));
        }
        return menuItems;
    }
View Full Code Here

     * @return a map of the string values indexed by property name
     */
    public Map<String, String> readPropertyMap(String responseText) {
        Document xml = XMLParser.parse(responseText);
        Map<String, String> retval = new HashMap<String, String>();
        NodeList list = xml.getElementsByTagName("property");
        for (int index = 0; index < list.getLength(); index++) {
            Element propElement = (Element) list.item(index);
            String key = propElement.getAttribute("key");
            String value = propElement.getAttribute("value");
            retval.put(key, value);
        }
        return retval;
View Full Code Here

     * @param responseText XML response to parse
     * @return a list of validation items
     */
    public List<FBValidationItem> readValidations(String responseText) throws Exception {
        Document xml = XMLParser.parse(responseText);
        NodeList validationList = xml.getElementsByTagName("validation");
        List<FBValidationItem> retval = new ArrayList<FBValidationItem>();
        for (int index = 0; index < validationList.getLength(); index++) {
            Element valElement = (Element) validationList.item(index);
            String klass = valElement.getAttribute("className");
            Object obj = ReflectionHelper.newInstance(klass);
            if (obj instanceof FBValidationItem) {
                FBValidationItem validItem = (FBValidationItem) obj;
                validItem.populatePropertiesMap(readValidationMap(valElement.getElementsByTagName("property")));
View Full Code Here

                } else if (obj instanceof FBMenuItem) {
                    menuItem = (FBMenuItem) obj;
                } else {
                    throw new Exception(i18n.NotOfType(itemClassName, "FBMenuItem"));
                }
                NodeList effects = ((Element) itemNode).getElementsByTagName("effect");
                for (FBFormEffect effect : readItemEffects(effects)) {
                    menuItem.addEffect(effect);
                }
                NodeList allowedEvents = ((Element) itemNode).getElementsByTagName("allowedEvent");
                for (String allowedEventName : readAllowedEvents(allowedEvents)) {
                    menuItem.addAllowedEvent(allowedEventName);
                }
                menuItems.add(menuItem);
            } catch (Exception e) {
View Full Code Here

        }
        return retval;
    }
   
    private FormItemRepresentation makeRepresentation(Node itemNode) throws FormEncodingException {
        NodeList list = ((Element) itemNode).getElementsByTagName("itemJson");
        FormItemRepresentation rep = null;
        if (list.getLength() > 0) {
            Node node = list.item(0);
            String json = getText(node);
            FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
            rep = (FormItemRepresentation) decoder.decodeItem(json);
        }
        return rep;
View Full Code Here

TOP

Related Classes of com.google.gwt.xml.client.NodeList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.