Get the text inside of the Xml element
@param element xml element
@return the text inside of the xml element
17127
private static String getText(Element element) {
    if (element.getFirstChild() == null) {
      return "";
    }
    return ((Text) element.getFirstChild()).getData().trim();
  }
21058
static String elementToString(Element element) {
    switch (element.getKind()) {
      case FIELD:
      // fall through
      case CONSTRUCTOR:
      // fall through
      case METHOD:
        return element.getEnclosingElement() + "." + element;
      default:
        return element.toString();
    }
  }
944831
public String getContent() {
		String content = "";
		
		NodeList list = dom.getChildNodes();
		for (int i=0;i<list.getLength();i++) {
			if (list.item(i) instanceof Text) {
				content += (list.item(i).getNodeValue());
			}
		}
		
		return content;
	}
698434
static final String path(Element element) {
        StringBuilder sb = new StringBuilder();

        Node iterator = element;
        while (iterator.getNodeType() == Node.ELEMENT_NODE) {
            sb.insert(0, $(iterator).tag());
            sb.insert(0, "/");

            iterator = iterator.getParentNode();
        }

        return sb.toString();
    }
861592
public String getNodeText(Object inNode)
  {
    String strValue = null;
    
    if (inNode instanceof Node)
    {
      Node theNode = (Node)inNode;
      // Check the type of the node

      String nodeName = theNode.getNodeName();
      if(nodeName == null)
        nodeName = "null";
      StringBuffer wholeString = new StringBuffer(nodeName);
      StringBuffer nodeDetailStr = null;

      NamedNodeMap nodeMap = theNode.getAttributes();
      if(nodeMap != null)
      {
        for(int i=0;i<nodeMap.getLength();i++)
        {
          Node attrNode = nodeMap.item(i);
          if(nodeDetailStr == null)
            nodeDetailStr = new StringBuffer("");
          nodeDetailStr.append(" ");
          nodeDetailStr.append(attrNode.getNodeName());
          nodeDetailStr.append(":");
          nodeDetailStr.append(attrNode.getNodeValue());
          if(i < nodeMap.getLength()-1)
            nodeDetailStr.append(", ");
        }
      }

      if(nodeDetailStr == null)
      {
        // Note this gets the text associated with the first child element only.
        Node firstChild = theNode.getFirstChild();
        if(firstChild != null)
        {
          String firstChildStr = firstChild.getNodeValue();
          if(firstChildStr != null)
            nodeDetailStr = new StringBuffer(firstChildStr);
        }
      }
      
      if(nodeDetailStr == null)
      {
        wholeString.append("(null)");
      }
      else
      {
        wholeString.append("(");
        wholeString.append(nodeDetailStr);
        wholeString.append(")");
      }
        strValue = wholeString.toString(); 
    }  // eof is inNode instanceof Node
    
    return strValue;
  }
1088805
public static Element stringToElement(String xml) throws Exception {
      ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes("utf8"));
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document d = builder.parse(bais);
      bais.close();
      return d.getDocumentElement();
   }
1005022
public XMLWriter startElement(String element) {
        append("<" + element);
        if (rootElement && xmlns != null) {
            append(" xmlns=\"" + xmlns + "\"");
            rootElement = false;
        }
        append(">");
        elementStack.push(element);
        return this;
    }
659970
static public String getTextValue(Node node) {
        if( node.getChildNodes().getLength() == 0 ) {
            return null;
        }
        return node.getFirstChild().getNodeValue();
    }
384054
private Object parseXmlElement(Element element) {
        if(element.getFirstChild() instanceof Text) {
            Text text = (Text) element.getFirstChild();
            return text.getData();
        }
        return element;
    }
43425
public static String findTitle(final String xml) {
        // Convert the string to a document to make it easier to get the proper title
        Document doc = null;
        try {
            doc = XMLUtilities.convertStringToDocument(xml);
        } catch (Exception ex) {
            LOG.debug("Unable to convert String to a DOM Document", ex);
        }

        return findTitle(doc);
    }
1065568
public MessageInfo getMessageInfo(String element)
    {
        MessageInfo recMessageInfo = (MessageInfo)this.getRecord(MessageInfo.MESSAGE_INFO_FILE);
        recMessageInfo.setKeyArea(MessageInfo.CODE_KEY);
        recMessageInfo.getField(MessageInfo.CODE).setString(element);
        try {
            if (recMessageInfo.seek(null))
            {
                return recMessageInfo;
            }
        } catch (DBException e) {
            e.printStackTrace();
        }
        return null;
    }
255198
public static String getChildValue(Element element, String name) {
        return getValue(getChild(element, name));
    }
1276800
public String text() {
        if (!element.is().present()) {
            return null;
        }
        WebElement webElement = element.getWebElement();
        return webElement.getText();
    }
1206610
protected String getValue(Element base, String tag) {

	    Element element = null;
		String result = "";
		try {
			// ZAP: Removed unnecessary cast.
			element = getElement(base, tag);
			result = getText(element);
		} catch (Exception e) {
		}
		return result;
	    
	}
569996
private String getNext() {
    StringBuilder result = new StringBuilder();
    try {
      XMLUtils.XMLTag tag;
      do {
        // String text =
        XMLUtils.readUntilTag(inputReader);
        // there may or may not be text before the next tag, but we discard it
        //        System.out.println("outside text: " + text );
        tag = XMLUtils.readAndParseTag(inputReader);
        //        System.out.println("outside tag: " + tag);
        if (tag == null) {
          return null; // couldn't find any more tags, so no more elements
        }
      } while (!tagNamePattern.matcher(tag.name).matches() ||
               tag.isEndTag || tag.isSingleTag);
      if (keepDelimitingTags) {
        result.append(tag.toString());
      }
      int depth = 1;
      while (true) {
        String text = XMLUtils.readUntilTag(inputReader);
        if (text != null) {
          // if the text isn't null, we append it
          //        System.out.println("inside text: " + text );
          result.append(text);
        }
        String tagString = XMLUtils.readTag(inputReader);
        tag = XMLUtils.parseTag(tagString);
        if (tag == null) {
          return null; // unexpected end of this element, so no more elements
        }
        if (tagNamePattern.matcher(tag.name).matches() && tag.isEndTag) {
          if ((countDepth && depth == 1) || !countDepth) {
            if (keepDelimitingTags) {
              result.append(tagString);
            }
            // this is our end tag so we stop
            break;
          } else {
            --depth;
            if (keepInternalTags) {
              result.append(tagString);
            }
          }
        } else if (tagNamePattern.matcher(tag.name).matches() && !tag.isEndTag &&
                   !tag.isSingleTag && countDepth) {
          ++depth;
          if (keepInternalTags) {
            result.append(tagString);
          }
        } else {
          // not our end tag, so we optionally append it and keep going
          if (keepInternalTags) {
            result.append(tagString);
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return result.toString();
  }
187164
def _get_element_text(self, element):
        
        text = ''
        if element.text is not None:
            text += element.text
        for child in element.getchildren():
            text += self._get_element_text(child)
        if element.tail is not None:
            text += element.tail
        return text
569157
public OMElement getElementFrom(OMNode element, String expression) throws XmlException {
        return getElementFrom(element, namespaces, expression, /* accept failure? */ false);
    }