Examples of nsIDOMNode


Examples of org.mozilla.interfaces.nsIDOMNode

      Map<String, String> attributes = new HashMap<String, String>();

      nsIDOMNamedNodeMap node_map = node.getAttributes();
      if (null != node_map) {
         for (long l = 0, len = node_map.getLength(); l < len; l++) {
            nsIDOMNode attribute = node_map.item(l);
            String name = attribute.getNodeName();
            String value = attribute.getNodeValue();
            attributes.put(name, value);
            }
         }

      return attributes;
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

   public static String getAttributeValue(nsIDOMNode node, String name) {
      String value = null;

      nsIDOMNamedNodeMap attributes = node.getAttributes();
      if (null != attributes) {
         nsIDOMNode attribute = attributes.getNamedItem(name);
         if (null != attribute) {
            value = attribute.getNodeValue();
            }
         }

      return value;
      }
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

         sb.append(text);
         }

      nsIDOMNodeList children = node.getChildNodes();
      for (long i = 0, len = children.getLength(); i < len; i++) {
         nsIDOMNode child = children.item(i);
         String text = asPlainText(child);
         sb.append(text);
         }

      String text = sb.toString();
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

            System.out.print(name + ",");
            }
         System.out.println();

         for (long i = 0; recursive && i < len; i++) {
            nsIDOMNode child = children.item(i);
            System.out.println("Inspecting children #" + i);
            inspect(child, true);
            }
         }
      else {
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

         sb.append(text);
         }

      nsIDOMNodeList children = node.getChildNodes();
      for (long i = 0, len = children.getLength(); i < len; i++) {
         nsIDOMNode child = children.item(i);
         String text = asPlainText(child);
         sb.append(text);
         }

      String text = sb.toString();
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

      Map<String, String> attributes = new HashMap<String, String>();

      nsIDOMNamedNodeMap node_map = node.getAttributes();
      if (null != node_map) {
         for (long l = 0, len = node_map.getLength(); l < len; l++) {
            nsIDOMNode attribute = node_map.item(l);
            String name = attribute.getNodeName();
            String value = attribute.getNodeValue();
            attributes.put(name, value);
            }
         }

      return attributes;
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

   public static String getAttributeValue(nsIDOMNode node, String name) {
      String value = null;

      nsIDOMNamedNodeMap attributes = node.getAttributes();
      if (null != attributes) {
         nsIDOMNode attribute = attributes.getNamedItem(name);
         if (null != attribute) {
            value = attribute.getNodeValue();
            }
         }

      return value;
      }
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

   //        cellpadding="0"
   //        itemtype="http://schema.org/CreativeWork"
   //        itemscope=""
   //        style="padding:0px; margin: 0px 0px 10px 0px; width:100%">

      final nsIDOMNode table = context.mock(nsIDOMNode.class);
      final nsIDOMNamedNodeMap map = context.mock(nsIDOMNamedNodeMap.class);

      final nsIDOMNode[] nodes = new nsIDOMNode[] {
         context.mock(nsIDOMNode.class, "cellspacing"),
         context.mock(nsIDOMNode.class, "cellpadding"),
         context.mock(nsIDOMNode.class, "itemtype"),
         context.mock(nsIDOMNode.class, "itemscope"),
         context.mock(nsIDOMNode.class, "style"),
         };

      final String[] names = new String[] {
         "cellspacing", "cellpadding", "itemtype", "itemscope", "style",
         };

      final String[] values = new String[] {
         "0", "0", "http://schema.org/CreativeWork", "", "padding:0px; margin: 0px 0px 10px 0px; width:100%",
         };

      context.checking(new Expectations() { {
         this.oneOf(table).getAttributes();
         this.will(returnValue(map));

         this.oneOf(map).getLength();
         this.will(returnValue(5L));

         for (long l = 0L, len = 5; l < len; l++) {
            nsIDOMNode node = nodes[(int) l];
            String name = names[(int) l];
            String value = values[(int) l];

            this.oneOf(map).item(l);
            this.will(returnValue(node));
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

         crawler = new Crawler() { /* nothing */ };

         URL url = SelectorTest.class.getResource("/select.all.children.html");
         crawler.navigateTo(url);

         nsIDOMNode document = crawler.getDocument();

         Selector selector = new Selector(document);
         List<nsIDOMNode> children = selector.getAllChildren(document);

//         for (nsIDOMNode child : children) {
View Full Code Here

Examples of org.mozilla.interfaces.nsIDOMNode

         List<nsIDOMNode> css = crawler.selector().add(Filters.css("target")).list();
         assertEquals(2, css.size());
         assertEquals("H3", css.get(0).getNodeName());
         assertEquals("H6", css.get(1).getNodeName());

         nsIDOMNode node = crawler.selector().add(Filters.css("target")).get();
         assertEquals("H3", node.getNodeName());
         }
      finally {
         if (null != crawler) {
            crawler.teardown();
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.