Package org.w3c.dom

Examples of org.w3c.dom.NodeList


        }
        return parent;
    }
   
    public Collection<Element> getChildren(Element elem, String name) {
      NodeList children = elem.getChildNodes();
      LinkedList<Element> results = new LinkedList<Element>();
      for (int i = 0; i < children.getLength(); i++) {
        Node node = children.item(i);
        if (node instanceof Element && node.getNodeName().equals(name)) {
          results.add((Element)node);
        }
      }
      return results;
View Full Code Here


      }
      return results;
    }
   
    public Element getChild(Element elem, String name) {
      NodeList children = elem.getChildNodes();
      for (int i = 0; i < children.getLength(); i++) {
        Node node = children.item(i);
        if (node instanceof Element && node.getNodeName().equals(name)) {
          return (Element)node;
        }
      }
      return null;
View Full Code Here

        boolean hasValueAttribute = property
            .hasAttribute(VALUE_ATTRIBUTE);
        boolean hasRefAttribute = property.hasAttribute(REF_ATTRIBUTE);

        // 只能有一个子元素: ref, value, list, etc.
        NodeList nl = property.getChildNodes();
        Element subElement = null;
        for (int i = 0; i < nl.getLength(); ++i) {
          Node node = nl.item(i);
          if (node instanceof Element) {
            if (subElement != null) {
              error(name
                  + " must not contain more than one sub-element");
            } else {
View Full Code Here

      Run run = new Run(args);
      
     try {
    
      XMLNode lstLogSourceNode = (XMLNode) xmlConfig.getNode("/log4plsql");
      NodeList listLogSource = lstLogSourceNode.selectNodes("logSource");
      XMLNode theLogSource;
      dbLogger.debug("Nbr backgroundProcess to launch :"+listLogSource.getLength());
      if (listLogSource.getLength() < 1 )
        dbLogger.error("No backgroundProcess to launch");
      for (int i=0; i<listLogSource.getLength(); i++){
        dbLogger.debug("start " + i + " backgroundProcess");
        theLogSource = (XMLNode) listLogSource.item(i);
        ReaderThread theReaderDBThread = new ReaderThread(theLogSource, dbLogger);    
        theReaderDBThread.start();
        }
    } catch (Exception e) {
      dbLogger.error(e.toString());
View Full Code Here

      }
   }

   private static void fetchTasksByTagName(String tagName, Element rootElement, List<SkinConfigTask> tasks)
   {
      NodeList nodes = rootElement.getElementsByTagName(tagName);
      GateinResource task;

      for (int i = nodes.getLength() - 1; i >= 0; i--)
      {
         task = elemtToTask(tagName);
         if (task != null)
         {
            task.binding((Element)nodes.item(i));
            tasks.add((SkinConfigTask)task);
         }
      }
   }
View Full Code Here

        if(paramBody.hasNext()){
          Element responseElm = (Element)paramBody.next();
          if(parameter.isWrapperStyle()){
            List<ParameterImpl> children = ((WrapperParameter)parameter).getWrapperChildren();
            for(ParameterImpl param : children){
              NodeList paramElm = responseElm.getElementsByTagNameNS(param.getName().getNamespaceURI(),
                  param.getPartName());
              if(paramElm.getLength() == 1){
                responseParametersMap.put(param.getPartName(),
                    param.getBridge().unmarshal(paramElm.item(0)));
              }
            }
          }else{
            responseParametersMap.put(parameter.getPartName(),
                parameter.getBridge().unmarshal(responseElm));
View Full Code Here

      // targetRef
      String to = subNode.getTextContent();
      // assignment
      subNode = subNode.getNextSibling();
        org.w3c.dom.Node subSubNode = subNode.getFirstChild();
        NodeList nl = subSubNode.getChildNodes();
        if (nl.getLength() > 1) {
            // not supported ?
            workItemNode.getWork().setParameter(dataInputs.get(to), subSubNode.getTextContent());
            return;
        } else if (nl.getLength() == 0) {
            return;
        }
        Object result = null;
        Object from = nl.item(0);
        if (from instanceof Text) {
            String text = ((Text) from).getTextContent();
            if (text.startsWith("\"") && text.endsWith("\"")) {
                    result = text.substring(1, text.length() -1);
            } else {
                result = text;
            }
      } else {
          result = nl.item(0);
      }
        workItemNode.getWork().setParameter(dataInputs.get(to), result);
    }
    }
View Full Code Here

   * @param  namespaceURI  the URI of the namespace
   * @param  localName    the tag name
   * @param  value      the new content for the tag
   */
  public void replace(String namespaceURI, String localName, String value) {
    NodeList nodes = domDocument.getElementsByTagNameNS(namespaceURI, localName);
    Node node;
    for (int i = 0; i < nodes.getLength(); i++) {
      node = nodes.item(i);
      setNodeText(domDocument, node, value);
    }
  }   
View Full Code Here

           
            if (targetElem == null) {
                throw new RuntimeException("Nothing was selected by the to expression " + to + " on " + targetExpr);
            }
        }
        NodeList nl = null;
        if (source instanceof org.w3c.dom.Node) {
             nl = (NodeList) exprFrom.evaluate(source, XPathConstants.NODESET);
        } else if (source instanceof String) {
            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = builder.newDocument();
            //quirky: create a temporary element, use its nodelist
            Element temp = doc.createElementNS(null, "temp");
            temp.appendChild(doc.createTextNode((String) source));
            nl = temp.getChildNodes();
        } else if (source == null) {
            // don't throw errors yet ?
            throw new RuntimeException("Source value was null for source " + sourceExpr);
        }
       
        if (nl.getLength() == 0) {
            throw new RuntimeException("Nothing was selected by the from expression " + from + " on " + sourceExpr);
        }
        for (int i = 0 ; i < nl.getLength(); i++) {
           
            if (!(targetElem instanceof org.w3c.dom.Node)) {
                if (nl.item(i) instanceof Attr) {
                    targetElem = ((Attr) nl.item(i)).getValue();
                } else if (nl.item(i) instanceof Text) {
                    targetElem = ((Text) nl.item(i)).getWholeText();
                } else {
                    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                    Document doc = builder.newDocument();
                    targetElem  = doc.importNode(nl.item(i), true);
                }
                target = targetElem;
            } else {
                org.w3c.dom.Node n  = ((org.w3c.dom.Node) targetElem).getOwnerDocument().importNode(nl.item(i), true);
                if (n instanceof Attr) {
                    ((Element) targetElem).setAttributeNode((Attr) n);
                } else {
                    ((org.w3c.dom.Node) targetElem).appendChild(n);
                }
View Full Code Here

   private List<JavascriptTask> fetchTasksFromXMLConfig(Document document)
   {
      List<JavascriptTask> tasks = new ArrayList<JavascriptTask>();
      Element element = document.getDocumentElement();
      NodeList nodes = element.getElementsByTagName(GateinResource.JAVA_SCRIPT_TAG);
      int length = nodes.getLength();
      for (int i = 0; i < length; i++)
      {
         JavascriptTask task = xmlToTask((Element)nodes.item(i));
         if (task != null)
         {
            tasks.add(task);
         }
      }
View Full Code Here

TOP

Related Classes of org.w3c.dom.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.