Package com.google.gwt.xml.client

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


        }
        return rep;
    }
   
    private String getText(Node node) {
        NodeList list = node.getChildNodes();
        StringBuilder builder = new StringBuilder();
        for (int index = 0; index < list.getLength(); index++) {
            builder.append(list.item(index).getNodeValue());
        }
        return builder.toString();
    }
View Full Code Here


     * @param responseText the XML response.
     * @return a list of Strings representing names of files.
     */
    public List<String> readFiles(String responseText) {
        Document xml = XMLParser.parse(responseText);
        NodeList list = xml.getElementsByTagName("file");
        List<String> retval = new ArrayList<String>();
        if (list != null) {
            for (int index = 0; index < list.getLength(); index++) {
                Node node = list.item(index);
                String url = getText(node);
                retval.add(url);
            }
        }
        return retval;
View Full Code Here

  @SuppressWarnings("unchecked")
  public D read(Object loadConfig, Object data) {
    Document doc = XMLParser.parse((String) data);

    NodeList list = doc.getElementsByTagName(modelType.getRecordName());
    ArrayList<ModelData> records = new ArrayList<ModelData>();
    for (int i = 0; i < list.getLength(); i++) {
      Node node = list.item(i);
      Element elem = (Element) node;
      ModelData model = newModelInstance();
      for (int j = 0; j < modelType.getFieldCount(); j++) {
        DataField field = modelType.getField(j);
        Class type = field.getType();
View Full Code Here

  @Override
  public XMLPacket getFirstChild(final String name, final String namespace) {
    checkNotNull(name);
    checkNotNull(namespace);

    final NodeList nodes = element.getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
      final Node node = nodes.item(i);
      if (node.getNodeType() != Node.ELEMENT_NODE) {
        continue;
      }

      final Element element = (Element) node;
View Full Code Here

    checkNotNull(name);
    checkNotNull(namespace);

    final ImmutableList.Builder<XMLPacket> result = ImmutableList.builder();

    final NodeList nodes = element.getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
      final Node node = nodes.item(i);
      if (node.getNodeType() != Node.ELEMENT_NODE) {
        continue;
      }

      final Element element = (Element) node;
View Full Code Here

  }

  @Override
  public String getText() {
    final StringBuilder result = new StringBuilder();
    final NodeList nodes = element.getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
      final Node child = nodes.item(i);
      if (child.getNodeType() == Node.TEXT_NODE)
        result.append(child.getNodeValue());
    }

    return result.toString();
View Full Code Here

  }

  @Override
  public void setText(final String text) {
    // TODO: remove ALL children?
    final NodeList nodes = element.getChildNodes();
    for (int i = 0; i < nodes.getLength(); i++) {
      final Node child = nodes.item(i);
      if (child.getNodeType() == Node.TEXT_NODE) {
        element.removeChild(child);
      }
    }
    if (!Strings.isNullOrEmpty(text)) {
View Full Code Here

    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

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.