Package org.w3c.dom

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


      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

            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

    public StylesheetInfo[] getStylesheets(org.w3c.dom.Document doc) {
        List list = new ArrayList();
        //get the processing-instructions (actually for XmlDocuments)
        //type and href are required to be set
        NodeList nl = doc.getChildNodes();
        for (int i = 0, len = nl.getLength(); i < len; i++) {
            Node node = nl.item(i);
            if (node.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE) continue;
            ProcessingInstruction piNode = (ProcessingInstruction) node;
            if (!piNode.getTarget().equals("xml-stylesheet")) continue;
            StylesheetInfo info = new StylesheetInfo();
            info = new StylesheetInfo();
View Full Code Here

  @Override
  public List<Element> elements(Element e, String name) {
    List<Element> eList = new ArrayList<Element>();

    NodeList nodeList = e.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); ++i) {
      Node node = nodeList.item(i);
      if (node.getNodeType() == Node.ELEMENT_NODE) {
        if (name != null) {
          if (node.getNodeName().equals(name))
            eList.add((Element) node);
        } else {
View Full Code Here

    return eList;
  }

  @Override
  public Element element(Element e, String name) {
    NodeList element = e.getElementsByTagName(name);
    if (element != null && e.getNodeType() == Node.ELEMENT_NODE) {
      return (Element) element.item(0);
    }
    return null;
  }
View Full Code Here

  @Override
  public String getTextValue(Element valueEle) {
    if (valueEle != null) {
      StringBuilder sb = new StringBuilder();
      NodeList nl = valueEle.getChildNodes();
      for (int i = 0; i < nl.getLength(); i++) {
        Node item = nl.item(i);
        if ((item instanceof CharacterData && !(item instanceof Comment))
            || item instanceof EntityReference) {
          sb.append(item.getNodeValue());
        }
      }
View Full Code Here

       
        getCss().removeStyle(e);
        getReplacedElementFactory().remove(e);
       
        if (e.hasChildNodes()) {
            NodeList children = e.getChildNodes();
            for (int i = 0; i < children.getLength(); i++) {
                Node child = children.item(i);
                if (child.getNodeType() == Node.ELEMENT_NODE) {
                    removeElementReferences((Element)child);
                }
            }
        }
View Full Code Here

   */
  public MappingFileData load() {
    DozerBuilder builder = new DozerBuilder();

    Element theRoot = document.getDocumentElement();
    NodeList nl = theRoot.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
      Node node = nl.item(i);
      if (node instanceof Element) {
        Element ele = (Element) node;
        log.debug("name: {}", ele.getNodeName());       
        if (CONFIGURATION_ELEMENT.equals(ele.getNodeName())) {
          parseConfiguration(ele, builder);
View Full Code Here

    if (StringUtils.isNotEmpty(getAttribute(ele, TYPE_ATTRIBUTE))) {
      String mappingDirection = getAttribute(ele, TYPE_ATTRIBUTE);
      MappingDirection direction = MappingDirection.valueOf(mappingDirection);
      definitionBuilder.type(direction);
    }
    NodeList nl = ele.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
      Node node = nl.item(i);
      if (node instanceof Element) {
        Element element = (Element) node;
        debugElement(element);
        if (CLASS_A_ELEMENT.equals(element.getNodeName())) {
          String typeName = getNodeValue(element);
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.