Package org.w3c.dom

Examples of org.w3c.dom.Node


      Method method = null;
      Object obj = null;
      String classNameField = "";
      Class argumentType[] = null;

      Node get = attr.getNamedItem("get");

      if (get == null)
      {
        retXML = nextXML(objectCV, config.getFirstChild(), className);
      } else
      {
        classNameField = attr.getNamedItem("type").getNodeValue();
        method = classCV[0].getMethod(get.getNodeValue(), argumentType);
        obj = method.invoke(objectCV, argumentType);
        retXML = nextXML(obj, config.getFirstChild(), classNameField);
      }
    } catch (Exception e)
    {
View Full Code Here


      String tmp = "";
      String tmpXML = "";
      String className = getValueOfNodeByTagName(configXML, TAG_VONAME);
      classCV[0] = Class.forName(className);

      Node met = null;
      NodeList listItem = configXML.getChildNodes();

      int length = listItem.getLength();

      for (int i = 0; i < length; i++)
      {

        tagName = listItem.item(i).getNodeName();

        if (tagName.equals("#text") || !listItem.item(i).hasAttributes())
          continue;

        NamedNodeMap attr = listItem.item(i).getAttributes();

        if (attr.getNamedItem("cvtoaa") != null)
        {
          tmpXML = getAAfromCV(objectCV, attr, classCV, tagName);

          if (!tmpXML.trim().equals(""))
            xml += tmpXML;

          continue;
        }

        if (attr.getNamedItem("xml") != null)
        {
          configForQBXML = getDocumentFromString(getDocumentFromString(attr.getNamedItem("xml").getNodeValue()).getElementsByTagName(attr.getNamedItem("tag").getNodeValue()).item(0).toString());

          tmpXML = forwardXML(classCV, attr, objectCV, className, configForQBXML);

          if (!tmpXML.trim().equals(""))
            xml += "<" + tagName + ">" + tmpXML + "</" + tagName + "> \n";

          continue;
        }
        met = attr.getNamedItem("get");
        method = classCV[0].getMethod(met.getNodeValue(), null);
        ret = method.invoke(objectCV, null);

        if (ret != null)
        {
          value = ret.toString();
          if (met.getNodeValue().equalsIgnoreCase("getExternalID"))
          {
            xml += "<" + tagName + ">" + value + "</" + tagName + "> \n";
            xml += "<EditSequence>" + hm.get(value) + "</EditSequence> \n";

            continue;
View Full Code Here

      String xmlMod = "";
      String xmlAdd = "";
      String tempXML = "";

      Node config = configForQBXML.getFirstChild();

      for (int i = 0; i < length; i++)
      {
        tempXML = getQBXMLFromVO(objectsCV.get(i), config, hm);
View Full Code Here

   * @param tag String Tag
   * @return String Value
   */
  public String getValueOfNodeByTagName(Node node, String tag)
  {
    Node nextNode = null;
    String value = "";

    try
    {

      if (node.getNodeName().equals(tag))
      {
        return node.getFirstChild().getNodeValue();
      }

      if (node.hasChildNodes())
      {
        nextNode = node.getFirstChild();

        while (nextNode != null)
        {
          value = getValueOfNodeByTagName(nextNode, tag);
          nextNode = nextNode.getNextSibling();

          if (value != null)
          {
            return value;
          }
View Full Code Here

   * @param node Node QB XML
   * @return String Name for QB XML
   */
  public String getQBXMLName(Node node)
  {
    Node nextFils = null;
    String name;
    try
    {
      if (node.hasAttributes())
      {
        NamedNodeMap atts;
        atts = node.getAttributes();

        if (atts.getNamedItem(ATTR_REQUEST_ID) != null)
        {

          return node.getNodeName();
        }
      }
      if (node.hasChildNodes())
      {
        nextFils = node.getFirstChild();
        while (nextFils != null)
        {
          name = getQBXMLName(nextFils);
          nextFils = nextFils.getNextSibling();
          if (name != null)
          {
            return name;

          }
View Full Code Here

  {
    NodeList childNodes = root.getChildNodes();
    List<Node> tobeRemoved = new ArrayList<Node>();
    for(int i=0; i<childNodes.getLength(); i++)
    {
      Node node = childNodes.item(i);
      short type = node.getNodeType();
      if(Node.ELEMENT_NODE == type)
        normalize(node);
      else if(Node.TEXT_NODE == type)
      {
        if(childNodes.getLength()>1) // mixed content
View Full Code Here

    @Test
    public void testFirstElement() throws Exception {
        String str = "<root>dflg<firstelement/></root>";
        Document doc = Helper.getAsDocument(str);
        Node root = Helper.getFirstElement(doc.getElementsByTagName("root"));
        assertEquals(root.getNodeName(), "root");

        assertEquals(
                Helper.getFirstElement(root.getChildNodes()).getNodeName(),
                "firstelement");
    }
View Full Code Here

  }

  @Test
  public void testGetNodeValue() {
    Element element = mock(Element.class);
    Node node = mock(Node.class);
    when(node.getNodeValue()).thenReturn(" B ");
    when(element.getFirstChild()).thenReturn(node);

    String result = reader.getNodeValue(element);

    assertEquals("B", result);
View Full Code Here

  }

  @Test
  public void testNodeValueIsNull() {
    Element element = mock(Element.class);
    Node node = mock(Node.class);
    when(node.getNodeValue()).thenReturn(null);
    when(element.getFirstChild()).thenReturn(node);

    assertEquals("", reader.getNodeValue(element));
  }
View Full Code Here

    public void fillDependencies(Collection<File> files, Document doc) {
        Element rootElement = Helper.getFirstElement(doc.getElementsByTagName("dependencies"));
        NodeList nodeList = rootElement.getElementsByTagName("dependency");
        for (int i = 0; i < nodeList.getLength(); i++) {
            Node n = nodeList.item(i);
            if (n.getNodeType() != Node.ELEMENT_NODE) {
                continue;
            }
            Element element = (Element) n;
            boolean include = true;
            StringBuilder path = new StringBuilder(mavenRepoPath);
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.