Package org.w3c.dom

Examples of org.w3c.dom.Node


  }

  private void parseVariables(Element element) {
    NodeList nl = element.getChildNodes();
    for (int i = 0; i < nl.getLength(); i++) {
      Node node = nl.item(i);
      if (node instanceof Element) {
        Element ele = (Element) node;

        debugElement(ele);
View Full Code Here


  }

  private void parseCustomConverters(Element ele, DozerBuilder.ConfigurationBuilder config) {
    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 (CONVERTER_ELEMENT.equals(element.getNodeName())) {
          String converterType = getAttribute(element, TYPE_ATTRIBUTE);
          DozerBuilder.CustomConverterBuilder customConverterBuilder = config.customConverter(converterType);

          NodeList list = element.getChildNodes();
          for (int x = 0; x < list.getLength(); x++) {
            Node node1 = list.item(x);
            if (node1 instanceof Element) {
              Element element1 = (Element) node1;
              if (CLASS_A_ELEMENT.equals(element1.getNodeName())) {
                customConverterBuilder.classA(getNodeValue(element1));
              } else if (CLASS_B_ELEMENT.equals(element1.getNodeName())) {
View Full Code Here

  }

  private void parseCopyByReferences(Element ele, DozerBuilder.ConfigurationBuilder config) {
    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);
View Full Code Here

  }

  private void parseAllowedExceptions(Element ele, DozerBuilder.ConfigurationBuilder config) {
    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);
View Full Code Here

        extractValuesFromElement(node, result);
      } else {
        NodeList children = node.getChildNodes();
        if(null != children && children.getLength() > 0) {
          for( int i = 0; i < children.getLength(); i++) {
            Node item = children.item(i);
            if(item instanceof Element) {
              Element childElement = (Element)item;
              if(isSObject(childElement)) {
                extractValuesFromElement(childElement, result);
              } else if(item.getChildNodes().getLength() > 0) {
                extactJoinResults(childElement, result);
              }
            }
          }
        }
View Full Code Here

        bout.close();
        DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
        fact.setNamespaceAware(true);
        DocumentBuilder db = fact.newDocumentBuilder();
        domDocument = db.parse(new ByteArrayInputStream(bout.toByteArray()));  
        Node n = domDocument.getFirstChild();
        while (n.getChildNodes().getLength() == 0) {
          n = n.getNextSibling();
        }
        n = n.getFirstChild();
        while (n != null) {
            if (n.getNodeType() == Node.ELEMENT_NODE) {
                String s = n.getLocalName();
                if (s.equals("template")) {
                  templateNode = n;
                    templateSom = new Xml2SomTemplate(n);
                }
                else if (s.equals("datasets")) {
                    datasetsNode = n;
                    datasetsSom = new Xml2SomDatasets(n.getFirstChild());
                }
            }
            n = n.getNextSibling();
        }
    }
View Full Code Here

        return getNodeText(n, "");
       
    }
   
    private static String getNodeText(Node n, String name) {
        Node n2 = n.getFirstChild();
        while (n2 != null) {
            if (n2.getNodeType() == Node.ELEMENT_NODE) {
                name = getNodeText(n2, name);
            }
            else if (n2.getNodeType() == Node.TEXT_NODE) {
                name += n2.getNodeValue();
            }
            n2 = n2.getNextSibling();
        }
        return name;
    }
View Full Code Here

     * @param text the text to add
     */
    public void setNodeText(Node n, String text) {
        if (n == null)
            return;
        Node nc = null;
        while ((nc = n.getFirstChild()) != null) {
            n.removeChild(nc);
        }
        if (n.getAttributes().getNamedItemNS(XFA_DATA_SCHEMA, "dataNode") != null)
            n.getAttributes().removeNamedItemNS(XFA_DATA_SCHEMA, "dataNode");
View Full Code Here

         * @return the new <CODE>Node</CODE> of the inserted name
         */
        public Node insertNode(Node n, String shortName) {
            Stack2 stack = splitParts(shortName);
            org.w3c.dom.Document doc = n.getOwnerDocument();
            Node n2 = null;
            n = n.getFirstChild();
            for (int k = 0; k < stack.size(); ++k) {
                String part = (String)stack.get(k);
                int idx = part.lastIndexOf('[');
                String name = part.substring(0, idx);
                idx = Integer.parseInt(part.substring(idx + 1, part.length() - 1));
                int found = -1;
                for (n2 = n.getFirstChild(); n2 != null; n2 = n2.getNextSibling()) {
                    if (n2.getNodeType() == Node.ELEMENT_NODE) {
                        String s = escapeSom(n2.getLocalName());
                        if (s.equals(name)) {
                            ++found;
                            if (found == idx)
                                break;
                        }
                    }
                }
                for (; found < idx; ++found) {
                    n2 = doc.createElementNS(null, name);
                    n2 = n.appendChild(n2);
                    Node attr = doc.createAttributeNS(XFA_DATA_SCHEMA, "dataNode");
                    attr.setNodeValue("dataGroup");
                    n2.getAttributes().setNamedItemNS(attr);
                }
                n = n2;
            }
            inverseSearchAdd(inverseSearch, stack, shortName);
View Full Code Here

            order.add(shortName);
            return n2;
        }
       
        private static boolean hasChildren(Node n) {
            Node dataNodeN = n.getAttributes().getNamedItemNS(XFA_DATA_SCHEMA, "dataNode");
            if (dataNodeN != null) {
                String dataNode = dataNodeN.getNodeValue();
                if ("dataGroup".equals(dataNode))
                    return true;
                else if ("dataValue".equals(dataNode))
                    return false;
            }
            if (!n.hasChildNodes())
                return false;
            Node n2 = n.getFirstChild();
            while (n2 != null) {
                if (n2.getNodeType() == Node.ELEMENT_NODE) {
                    return true;
                }
                n2 = n2.getNextSibling();
            }
            return false;
        }
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.