Package org.w3c.dom

Examples of org.w3c.dom.Node


        PrintWriter pw = new PrintWriter(destFile);
        NodeList rs = (NodeList) xpath.evaluate(ADDR_TEST_GROUPS, catalog, XPathConstants.NODESET);
        final int rslen = rs.getLength();
        for(int i = 0; i < rslen; i++) {
            final String ADDR_TEST_GROUP = '(' + ADDR_TEST_GROUPS + ")[" + (i + 1) + ']';
            Node testGroup = rs.item(i);
            assert (testGroup != null);
            assert (testGroup.hasAttributes());
            String filepath = (String) xpath.evaluate("ns:test-case[1]/@FilePath", testGroup, XPathConstants.STRING);
            if(filepath == null || filepath.length() == 0) {
                // test-group might have no test-case
                continue;
            }
            assert (filepath.endsWith("/")) : filepath;
            String testDir = filepath.replace('-', '_').toLowerCase().substring(0, filepath.lastIndexOf('/'));
            String packageName = testDir.replace('/', '.');
            String[] dirs = testDir.split("/");
            assert (dirs.length > 0);
            File parentDir = new File(TEST_DEST_DIR);
            assert (parentDir.isDirectory());
            for(String dir : dirs) {
                assert (parentDir.exists());
                File curDir = new File(parentDir, dir);
                if(!curDir.exists()) {
                    boolean mkdirSucc = curDir.mkdir();
                    assert (mkdirSucc);
                    System.err.println("Created directory.. " + curDir.getAbsolutePath());
                }
                parentDir = curDir;
            }
            assert (parentDir.exists());
            final String CLASS_NAME = toClassName(testGroup.getAttributes().getNamedItem("name").getNodeValue())
                    + "Test";
            final String CLASS_SRC_FILE = CLASS_NAME + ".java";
            File classSrcFile = new File(parentDir, CLASS_SRC_FILE);
            if(!classSrcFile.exists()) {
                final String tmpl = IOUtils.toString(TestCodeGenerator.class.getResourceAsStream("XQTSTest.template"));
View Full Code Here


    {
        Document doc = getDocument();
        Element e = doc.createElementNS( "urn:test","root");
        e.setAttribute("xmlns", "urn:test");
        doc.appendChild(e);
        Node text = doc.createTextNode("Hello World");
        e.appendChild(text);
       
        DOMUtils.writeXml(doc,System.out);
       
        W3CDOMStreamReader reader = new W3CDOMStreamReader(e);
View Full Code Here

    if (info != null) {
      ArrayList properties = new ArrayList();
      NodeList childNodes = userObject.element.getChildNodes();

      for (int i = 0; i < childNodes.getLength(); i++) {
        Node node = childNodes.item(i);

        if (node.getNodeType() == Node.ELEMENT_NODE) {
          if (node.getNodeName().equals("property")) {
            properties.add(((Element) node).getAttribute("name"));
          } else if (node.getNodeName().equals("anchor")) {
            properties.add("anchor");
          } else if (node.getNodeName().equals("layout")) {
            properties.add("layout");
          }
        }

      }
View Full Code Here

    }

    rootNode.removeAllChildren();
    NodeList children = document.getDocumentElement().getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
      Node node = (Node) children.item(i);

      if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals("widget")) {
        traverseDocument((Element) node, rootNode);
      }
    }
    rootNode.setUserObject(new WidgetUserObject(document.getDocumentElement(), null, rootNode));
    widgetTree.structureChanged(rootNode);
View Full Code Here

 
    Element lastWidget = null, beforeWidget = null;
 
    int distance = -1;
    for (int i=0; i<nodes.getLength(); i++) {
      Node node = nodes.item(i);
      if (node == object.element) {
        if (up) {
          beforeWidget = lastWidget;
          break;
        } else {
View Full Code Here

    WidgetUserObject object = (WidgetUserObject) treeItem.getUserObject();

    if (object.element != null) {
      NodeList nodes = object.element.getChildNodes();
      for (int i = 0; i < nodes.getLength(); i++) {
        Node node = nodes.item(i);
        if (node instanceof Element && node.getNodeName().equals("property")) {
          Element propertyNode = (Element) node;
          String type = propertyNode.getAttribute("type");
          String name = propertyNode.getAttribute("name");
          if (type.equals("") || type.equals("istring")) {
            String text = XMLUtils.extractTextChildren(propertyNode);
View Full Code Here

  }

  // ----------------------------------------------------------

  public boolean allowHTML() {
    Node oItem = oNode.getAttributes().getNamedItem("allowHTML");

    if (null==oItem)
      return false;
    else
      return oItem.getNodeValue().equalsIgnoreCase("true") || oItem.getNodeValue().equalsIgnoreCase("yes") || oItem.getNodeValue().equals("1");
  } // allowHTML()
View Full Code Here

  } // allowHTML()

  // ----------------------------------------------------------

  public String id() {
    Node oItem = oNode.getAttributes().getNamedItem("id");

    if (null==oItem)
      return null;
    else
      return oItem.getNodeValue();
  } // id()
View Full Code Here

  /**
   * @return Block id attribute
   */
  public String id() {
    Node oItem = oNode.getAttributes().getNamedItem("id");

    if (null==oItem)
      return null;
    else
      return oItem.getNodeValue();
  } // id()
View Full Code Here

  } // id()

  // ----------------------------------------------------------

  public void id(String sNewId) {
    Node oItem = oNode.getAttributes().getNamedItem("id");

    oItem.setNodeValue(sNewId);
  }
View Full Code Here

TOP

Related Classes of org.w3c.dom.Node

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.