Package com.google.gwt.xml.client

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


 
 
  private HashMap<String, HashMap<String, String>> getSolutionFromNode(Node node) {
    HashMap<String, HashMap<String, String>> solution = new HashMap<String, HashMap<String, String>>();
   
    NodeList bindings = ((Element) node).getElementsByTagName("binding");
    for (int i = 0; i < bindings.getLength(); i++) {
      Node binding = bindings.item(i);
      solution.put(((Element) binding).getAttribute("name"), getBindingFromNode(binding));
    }
    return solution;
  }
View Full Code Here


    return solution;
  }
 
  private HashMap<String, String> getBindingFromNode(Node binding) {
    HashMap<String, String> rdfNode = new HashMap<String, String>();
    NodeList literals = ((Element) binding).getElementsByTagName("literal");
    if (literals.getLength() > 0) {
      rdfNode = extractValuesFromXmlNode(literals.item(0), new String[]{"xml:lang", "datatype"});
      rdfNode.put("type", "literal");
    }
    NodeList bnodes = ((Element) binding).getElementsByTagName("bnode");
    if (bnodes.getLength() > 0) {
      Node bnode = bnodes.item(0);
      rdfNode.put("type", "bnode");
      rdfNode.put("value", bnode.getFirstChild().getNodeValue());
    }
    NodeList uris = ((Element) binding).getElementsByTagName("uri");
    if (uris.getLength() > 0) {
      Node uri = uris.item(0);
      rdfNode.put("type", "uri");
      rdfNode.put("value", uri.getFirstChild().getNodeValue());
    }
    return rdfNode;
  }
View Full Code Here

    return booleanResult;
  }
 
 
  private void storeBooleanResult(Document xmlDoc) throws SparqlParseException {
    NodeList booleanNodeList = xmlDoc.getElementsByTagName("boolean");
    if (booleanNodeList.getLength() == 0) {
      throw new SparqlParseException("Missing boolean value in xml");
    }
    if (booleanNodeList.item(0).getFirstChild().getNodeValue().equals("true")) {
      booleanResult = true;
    } else {
      booleanResult = false;
    }
  }
View Full Code Here

  @SuppressWarnings({"unchecked", "rawtypes"})
  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

  }

  public ListLoadResult read(C loadConfig, Object data) {
    Document doc = XMLParser.parse((String) data);

    NodeList list = doc.getElementsByTagName(modelType.recordName);
    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);
        String map = field.map != null ? field.map : field.name;
View Full Code Here

    public static String getXmlNodeValue(Document doc, String tag) {
      if (doc == null) {
        return null;
      }

      NodeList list = doc.getElementsByTagName(tag);
      if (list.getLength() == 0) {
        return null;
      }

      Node node = list.item(0);
      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 node != null ? getTextValue(node) : null;
        }

        @Nullable
        private Node getUniqueElementByTagName(@Nonnull final String tagName) {
            NodeList nodes = ((Element)entryNode).getElementsByTagName(tagName);
            return nodes.getLength() == 1 ? nodes.item(0) : null;
        }
View Full Code Here

  @SuppressWarnings({"unchecked", "rawtypes"})
  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

  @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

      assertEquals("beans", beans.getTagName());
      assertNull(beans.getNextSibling());
      assertNull(beans.getPreviousSibling());

      Element testBean = document.getElementById("testBean");
      NodeList beanList = document.getElementsByTagName("bean");

      assertEquals(2, beanList.getLength());
      assertEquals("testBean", beanList.item(0).getAttributes().getNamedItem("id").getNodeValue());
      assertEquals("bean", testBean.getTagName());
      assertEquals("bean", testBean.getNodeName());
      assertEquals("http://www.springframework.org/schema/beans", testBean.getNamespaceURI());
      assertEquals("org.springframework.beans.TestBean", testBean.getAttribute("class"));
      assertTrue(testBean.hasAttribute("class"));
      assertFalse(testBean.hasAttribute("fooAttr"));
      Attr classAttr = testBean.getAttributeNode("class");
      assertEquals("class", classAttr.getName());
      assertEquals("org.springframework.beans.TestBean", classAttr.getValue());
      assertEquals("http://www.springframework.org/schema/beans", classAttr.getNamespaceURI());
      assertEquals("class", classAttr.getNodeName());
      // CDATA attribute
      Element ageProperty = (Element) testBean.getChildNodes().item(0);
      assertEquals(1, ageProperty.getAttributes().getLength());
      assertEquals("age", ageProperty.getAttribute("name"));
      assertEquals("<10>", ageProperty.getNodeValue());
      // TODO : pass this assertion
      // assertEquals("#cdata-section",
      // ageProperty.getFirstChild().getNodeName());

      // "spouse" child bean assertions
      NamedNodeMap innerBeanAgePropertyAttributes = beanList.item(1).getChildNodes().item(0).getAttributes();
      assertEquals("age", innerBeanAgePropertyAttributes.getNamedItem("name").getNodeValue());
      assertEquals("11", innerBeanAgePropertyAttributes.getNamedItem("value").getNodeValue());

      // bean from "util" namespace
      Element name = (Element) testBean.getNextSibling();
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.