Examples of NodeList


Examples of org.w3c.dom.NodeList

      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

Examples of org.w3c.dom.NodeList

      }
   }

   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

Examples of org.w3c.dom.NodeList

        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

Examples of org.w3c.dom.NodeList

      // 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

Examples of org.w3c.dom.NodeList

   * @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

Examples of org.w3c.dom.NodeList

           
            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

Examples of org.w3c.dom.NodeList

   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

Examples of org.w3c.dom.NodeList

         return null;
      }
      try
      {
         JavascriptTask task = new JavascriptTask();
         NodeList nodes = element.getElementsByTagName(GateinResource.JAVA_SCRIPT_PARAM);
         int length = nodes.getLength();
         for (int i = 0; i < length; i++)
         {
            Element param_ele = (Element)nodes.item(i);
            String js_module =
               param_ele.getElementsByTagName(GateinResource.JAVA_SCRIPT_MODULE).item(0).getFirstChild().getNodeValue();
            String js_path =
               param_ele.getElementsByTagName(GateinResource.JAVA_SCRIPT_PATH).item(0).getFirstChild().getNodeValue();
            Integer js_priority = null;
View Full Code Here

Examples of org.w3c.dom.NodeList

      factory.setCoalescing(true);
      factory.setNamespaceAware(false);
      factory.setValidating(false);
      DocumentBuilder parser = factory.newDocumentBuilder();
      Document document = parser.parse(is);
      NodeList nodes = document.getElementsByTagName("locale-config");
      for (int i = 0; i < nodes.getLength(); i++)
      {
         Node node = nodes.item(i);
         NodeList children = node.getChildNodes();
         LocaleConfig config = new LocaleConfigImpl();
         for (int j = 0; j < children.getLength(); j++)
         {
            Node element = children.item(j);
            if ("locale".equals(element.getNodeName()))
            {
               config.setLocale(element.getFirstChild().getNodeValue());
            }
            else if ("output-encoding".equals(element.getNodeName()))
View Full Code Here

Examples of org.w3c.dom.NodeList

            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
            Document doc = docBuilder.parse(new ByteArrayInputStream(xml.getBytes()));
              // normalize text representation
            doc.getDocumentElement ().normalize ();
            NodeList listOfResults = doc.getElementsByTagName("Result");
            for(int i= 0; i< listOfResults.getLength(); i++){
                   ResultGeoCodeApi result = new ResultGeoCodeApi();
                   Node nodeResult = listOfResults.item(i);
                   if(nodeResult.getNodeType() == Node.ELEMENT_NODE){
                    Element elementResult = (Element)nodeResult;
                    result.setPrecision(elementResult.getAttribute("precision"));

                   
                    NodeList latitudes = elementResult.getElementsByTagName("Latitude");
                    Element latitudeElement = (Element)latitudes.item(0);
                    NodeList latitudeNodes = latitudeElement.getChildNodes();
                    result.setLatitude(((Node)latitudeNodes.item(0)).getNodeValue().trim());

                    NodeList longitudes = elementResult.getElementsByTagName("Longitude");
                    Element longitudeElement = (Element)longitudes.item(0);
                    NodeList longitudeNodes = longitudeElement.getChildNodes();
                    result.setLongitude(((Node)longitudeNodes.item(0)).getNodeValue().trim());

                    NodeList addresses = elementResult.getElementsByTagName("Address");
                    Element addressElement = (Element)addresses.item(0);
                    NodeList addressNodes = addressElement.getChildNodes();
                    result.setAddress(((Node)addressNodes.item(0)).getNodeValue().trim());


                   
                    NodeList cities = elementResult.getElementsByTagName("City");
                    Element cityElement = (Element)cities.item(0);
                    NodeList cityNodes = cityElement.getChildNodes();
                    result.setCity(((Node)cityNodes.item(0)).getNodeValue().trim());

                    NodeList states = elementResult.getElementsByTagName("State");
                    Element stateElement = (Element)states.item(0);
                    NodeList stateNodes = stateElement.getChildNodes();
                    result.setState(((Node)stateNodes.item(0)).getNodeValue().trim());

                    NodeList zips = elementResult.getElementsByTagName("Zip");
                    Element zipElement = (Element)zips.item(0);
                    NodeList zipNodes = zipElement.getChildNodes();
                    result.setZip(((Node)zipNodes.item(0)).getNodeValue().trim());

                    NodeList countries = elementResult.getElementsByTagName("Country");
                    Element countryElement = (Element)countries.item(0);
                    NodeList countryNodes = countryElement.getChildNodes();
                    result.setCountry(((Node)countryNodes.item(0)).getNodeValue().trim());

                    results.add(result);
                   }

            }
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.