Package com.google.gwt.xml.client

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


    if (containsOnlyAllowedChildren(grammarsElement, WadlXml.grammarsChildren)) {     
      GrammarsNode grammars = new GrammarsNode(application);
      application.addGrammars(grammars);
     
      // grammarsChildren = {includeNode, docNode}
      NodeList childNodes = grammarsElement.getChildNodes();
      for (int i = 0; i < childNodes.getLength(); i++) {
        if (childNodes.item(i).getNodeName().equals(WadlXml.includeNode)) {
          if (!parseIncludeNode(childNodes.item(i), grammars));
        }
        else if (childNodes.item(i).getNodeName().equals(WadlXml.docNode)) {
          if (!parseDocNode(childNodes.item(i), grammars));
        }       
      }
    }
    else {
      alertInvalidWadlAndRetry(GuiFactory.notifications.invalidChildren(WadlXml.grammarsNode, allowedChildren(WadlXml.grammarsChildren)));
View Full Code Here


   * Ensures that a certain node contains only white-listed children
   * @param node The node to check
   * @param allowedChildren The allowed children
   */
  private boolean containsOnlyAllowedChildren(Node node, String[] allowedChildren) {
    NodeList childNodes = node.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {       
      if (!Tools.contains(allowedChildren, childNodes.item(i).getNodeName())) {       
        return false;      
      }     
    }
    return true;
  }
View Full Code Here

        state.add(new StateItem("address", position.getAddress()));

        String other = position.getOther();
        if (other != null) {
            try {
                NodeList nodes = XMLParser.parse(other).getFirstChild().getChildNodes();
                for (int i = 0; i < nodes.getLength(); i++) {
                    Node node = nodes.item(i);
                    state.add(new StateItem(node.getNodeName(), node.getFirstChild().getNodeValue()));
                }
            } catch (Exception error) {
            }
        }
View Full Code Here

    }

    public void onResponseReceived(Request request, Response response) {
        System.out.println("ReadLookupValuesCallback response.getText() = " + response.getText());
        responseDocument = XMLParser.parse(response.getText());
        NodeList entryNodes = responseDocument.getElementsByTagName("entry");

        for(int i=0; i < entryNodes.getLength(); i++){
            Node entryNode = entryNodes.item(i);
            NodeList entryNodeChilds = entryNode.getChildNodes();
            for(int j=0; j < entryNodeChilds.getLength(); j++){
                if (entryNodeChilds.item(j).getNodeName().equals("content")){
                    String lookupValue = entryNodeChilds.item(j).getFirstChild().getNodeValue();
                    System.out.println("lookupValue = " + lookupValue);
                    lookupValuesSet.add(lookupValue);
                }
            }
        }
View Full Code Here

     * @param childName The name of the child (tag name).
     * @return A single child element of the given parent, or {@code null} if none was found.
     * @throws XmlException When more than one child was found.
     */
    public static Element getSingleChild(Element parent, String childName) throws XmlException {
        NodeList nodes = parent.getElementsByTagName(childName);
        if (nodes.getLength() == 0) {
            return null;
        }
        if (nodes.getLength() > 1) {
            throw new XmlException("Found more than one <" + childName + "> element");
        }
        return (Element) nodes.item(0);
    }
View Full Code Here

    public static String getTextValue(Element element) {
        return getTextValue(element, null);
    }

    public static String getTextValue(Element element, String defaultValue) {
        NodeList nodes = element.getChildNodes();
        for (int i=0; i<nodes.getLength(); i++) {
            Node node = nodes.item(i);
            if (node.getNodeType() == Node.TEXT_NODE) {
                return node.getNodeValue();
            }
        }
        return defaultValue;
View Full Code Here

        private XmlParser() {
        }

        private void parseEntries(@Nonnull final Document document) {
            NodeList entryNodes = document.getElementsByTagName(ENTRY_TAG);

            if (entryNodes != null) {
                Node entryNode;
                for (int i = 0; i < entryNodes.getLength(); i++) {
                    entryNode = entryNodes.item(i);
                    assert entryNode != null;
                   
                    if (entryNode.getNodeType() == ELEMENT_NODE) {
                        entries.add(new Entry(entryNodes.item(i)));
                    }
                }
                Collections.reverse(entries);
            }
        }
View Full Code Here

        private XmlParser() {
        }

        private void parseLinks(@Nonnull final Document document) {
            NodeList linkNodes = document.getElementsByTagName(LINK_TAG);

            if (linkNodes != null) {
                Node linkNode;
                for (int i = 0; i < linkNodes.getLength(); i++) {
                    linkNode = linkNodes.item(i);
                    if (isLinkBelongToFeed(linkNode)) {
                        setLink(linkNode);
                    }
                }
            }
View Full Code Here

    public static Payload parseMessage(String message) {
        final Payload payload = new Payload();

        Document messageDom = XMLParser.parse(message);
        NodeList statements = messageDom.getElementsByTagName("it.freedomotic.reactions.Statement");
        for (int i = 0; i < statements.getLength(); i++) {
            Element statement = (Element) statements.item(i);
            payload.enqueueStatement(parseStatement(statement));
        }
        return payload;
    }
View Full Code Here

  public static Payload parseMessage(String message)
  {
    final Payload payload = new Payload();
   
    Document messageDom = XMLParser.parse(message);   
    NodeList statements = messageDom.getElementsByTagName("it.freedomotic.reactions.Statement");           
    for (int i = 0; i < statements.getLength(); i++) {
      Element statement = (Element)statements.item(i);
       payload.enqueueStatement(parseStatement(statement));    
     }       
        return payload;                          
  }
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.