Package org.w3c.dom

Examples of org.w3c.dom.Node


            return;
        }

        NodeList nodeList = rootElement.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node n = nodeList.item(i);
            if (n.getNodeType() != Node.ELEMENT_NODE) {
                continue;
            }
            Element element = (Element) n;
            properties.put(element.getNodeName(), element.getTextContent());
        }
View Full Code Here


                    Element elm = (Element) server.getAttribute(connectionFactoryOName, "ManagedConnectionFactoryProperties");

                    if (elm != null) {
                        NodeList nl = elm.getChildNodes();
                        for (int i = 0; i < nl.getLength(); i++) {
                            Node n = nl.item(i);
                            Node na = n.getAttributes().getNamedItem("name");
                            if (na != null) {
                                if ("ConnectionURL".equals(na.getNodeValue())) {
                                    dsInfo.setJdbcURL(n.getFirstChild().getNodeValue());
                                }

                                if ("UserName".equals(na.getNodeValue())) {
                                    dsInfo.setUsername(n.getFirstChild().getNodeValue());
                                }

                                //
                                // JMS datasource
                                //
                                if ("JmsProviderAdapterJNDI".equals(na.getNodeValue())) {
                                    dsInfo.setJdbcURL(n.getFirstChild().getNodeValue());
                                    resource.setType("jms");
                                }
                            }
                        }
View Full Code Here

    } else if (sourceClass == DOMSource.class) {
      try {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
              Node doc = docBuilder.parse(new InputSource(getBinaryStream()));
              return (T) new DOMSource(doc);
      } catch (ParserConfigurationException e) {
        throw new SQLException(e);
      } catch (SAXException e) {
        throw new SQLException(e);
View Full Code Here

   */
  private final void fillChildElementInfo(NodeList list, int depth,Map<String,Object> detail){
    if(depth < 0)
      return;
    for (int i =0; i < list.getLength(); i++) {
      Node type = list.item(i);
      if(type instanceof Element){
        String name = type.getLocalName();
        if(detail.containsKey(name)){
          name = name +i;
        }
        detail.put(name, type.getTextContent());
        Map<String,String> attributes = new HashMap<String, String>();
        for(int att = type.getAttributes().getLength() -1;att >-1;att--){
          Node node = type.getAttributes().item(att);
          attributes.put(node.getNodeName(), node.getNodeValue());
        }
        detail.put(name +"_attributes", attributes);
        Map<String,Object> subInfo = new HashMap<String, Object>();
        detail.put(name + "_detail", subInfo);
        fillChildElementInfo(type.getChildNodes(), depth - 1,subInfo);
View Full Code Here

        if (xfa.isXfaPresent()) {
            name = xfa.findFieldName(name, this);
            if (name == null)
                return false;
            String shortName = XfaForm.Xml2Som.getShortName(name);
            Node xn = xfa.findDatasetsNode(shortName);
            if (xn == null) {
                xn = xfa.getDatasetsSom().insertNode(xfa.getDatasetsNode(), shortName);
            }
            xfa.setNodeText(xn, value);
        }
View Full Code Here

   
    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

    }
   
    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

        // 只能有一个子元素: 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

        }

        Element element = ib.getElement();

        while (element != null && !style.isHoverStyled(element)) {
            Node node = element.getParentNode();
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                element = (Element) node;
            } else {
                element = null;
            }
        }
View Full Code Here

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

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.