Gets the element's text value from the XML object provided.
426906
def get_text(self, xml, name):
        
        nodes = xml.getElementsByTagName("wp:comment_" + name)[0].childNodes
        accepted_types = [Node.CDATA_SECTION_NODE, Node.TEXT_NODE]
        return "".join([n.data for n in nodes if n.nodeType in accepted_types])
527002
def _xml_element_value(el: Element, int_tags: list):
    
    # None
    if el.text is None:
        return None
    # int
    try:
        if el.tag in int_tags:
            return int(el.text)
    except:
        pass
    # default to str if not empty
    s = str(el.text).strip()
    return s if s else None
1305858
def get_text(item, tag, default=False):
        
        try:
            xmlnode = item.getElementsByTagName(tag)[0].firstChild
        except IndexError as e:
            if default is not False:
                return default
            else:
                raise IndexError(e)

        if xmlnode is not None:
            return unicode(xmlnode.nodeValue)
        # empty tag
        else:
            return ''
191038
protected static String getElement(JWTPayload payload, String element) {
        String output = null;
        if (payload != null) {
            Object outObj = payload.get(element);
            if (outObj instanceof String) {
                output = (String) outObj;
            } else if (outObj instanceof List) {
                if (((List<String>) outObj).size() == 1) {
                    output = ((List<String>) outObj).get(0);
                }
                // if there are multiple values, return null.
            }
        }
        return output;
    }
611052
def get_child_value(parent, name, allow_missing=0):
        
        if not parent.HasElement(name):
            if allow_missing:
                return np.nan
            else:
                raise Exception('failed to find child element %s in parent' % name)
        else:
            return XmlHelper.as_value(parent.GetElement(name))
894518
def _get_text(node, tag, default=None):
    """"""
    try:
        return node.find(tag).text
    except AttributeError:
        return default
326258
function textXml(data) {
                var xml = undefined,
                    tmp = undefined;
                if (!data || typeof data !== "string") {
                    return null;
                }

                // Support: IE9
                try {
                    tmp = new DOMParser();
                    xml = tmp.parseFromString(data, "text/xml");
                } catch (e) {
                    xml = undefined;
                }

                if (!xml || xml.getElementsByTagName("parsererror").length) {
                    throwError("Invalid XML: " + data);
                }
                return xml;
            }
118290
def xml2object(self, content):
        
        """
        content = self.xml_filter(content)
        element = ET.fromstring(content)
        tree = self.parse(element) if self.__options['strip_attr'] else self.parse_full(element)
        if not self.__options['strip_root']:
            node = self.get_node(element)
            if not self.__options['strip_attr']:
                tree['attrs'] = node['attr']
            return {node['tag']: tree}
        return tree
226042
def fromxml(node):
        """"""
        if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access
            node = ElementTree.parse(StringIO(node)).getroot()
        if node.tag in globals():
            id = ''
            paramflag = ''
            name = ''
            description = ''
            kwargs = {}
            error = None
            for attrib, value in node.attrib.items():
                if attrib == 'id':
                    id = value
                elif attrib == 'paramflag':
                    paramflag = value
                elif attrib == 'name':
                    name = value
                elif attrib == 'description':
                    description = value
                elif attrib == 'error':
                    error = value
                else:
                    kwargs[attrib] = value

            #extra parsing for choice parameter (TODO: put in a better spot)
            if 'multi' in kwargs and (kwargs['multi'] == 'yes' or kwargs['multi'] == '1' or kwargs['multi'] == 'true'):
                kwargs['value'] = []

            for subtag in node: #parse possible subtags
                if subtag.tag == 'choice': #extra parsing for choice parameter (TODO: put in a better spot)
                    if 'choices' not in kwargs: kwargs['choices'] = {}
                    kwargs['choices'][subtag.attrib['id']] = subtag.text
                    if 'selected' in subtag.attrib and (subtag.attrib['selected'] == '1' or subtag.attrib['selected'] == 'yes'):
                        if 'multi' in kwargs and (kwargs['multi'] == 'yes' or kwargs['multi'] == '1' or kwargs['multi'] == 'true'):
                            kwargs['value'].append(subtag.attrib['id'])
                        else:
                            kwargs['value'] = subtag.attrib['id']

            parameter = globals()[node.tag](id, name, description, **kwargs) #return parameter instance
            if error:
                parameter.error = error #prevent error from getting reset
            return parameter
        else:
            raise Exception("No such parameter exists: " + node.tag)
706764
def get_node(self, element):
        
        """
        ns, tag = self.split_namespace(element.tag)
        return {'tag': tag, 'value': (element.text or '').strip(), 'attr': element.attrib, 'namespace': ns}
1267319
def _fetch_xml(self, url):
        """"""
        with contextlib.closing(urlopen(url)) as f:
            return xml.etree.ElementTree.parse(f).getroot()
566167
def get_xml(self, encoding='unicode'):
        
        return xml.etree.ElementTree.tostring(self._root_el, encoding)
1186521
def get_xml_str(self, data):
        

        responses = []
        for tag, value in data.items():
            elem = Element(tag)
            if isinstance(value, dict):
                for value in self.get_xml_str(value):
                    elem.append(value)
            elif isinstance(value, list):
                value = ', '.join([m for m in value])
                elem.text = value
            else:
                elem.text = value
            responses.append(elem)
        return responses
885340
function (elem)
    {
        if (!elem) { return null; }

        var str = "";
        if (elem.childNodes.length === 0 && elem.nodeType ==
            Strophe.ElementType.TEXT) {
            str += elem.nodeValue;
        }

        for (var i = 0; i < elem.childNodes.length; i++) {
            if (elem.childNodes[i].nodeType == Strophe.ElementType.TEXT) {
                str += elem.childNodes[i].nodeValue;
            }
        }

        return Strophe.xmlescape(str);
    }
1276800
public String text() {
        if (!element.is().present()) {
            return null;
        }
        WebElement webElement = element.getWebElement();
        return webElement.getText();
    }
868514
private String getNextElementsValue(String wantedName) throws IOException {
    boolean gotSTART_ELEMENT = false;
    try {
      int eventType = in.getEventType();
      while(true) {
        switch(eventType) {
          case XMLStreamConstants.CHARACTERS: // 4
            if(gotSTART_ELEMENT) {
              // XML returns "\n" instead of empty (zero-length) string
              // for elements like <x></x>
              return in.getText().trim();
            }
            break;
          case XMLStreamConstants.END_DOCUMENT: // 8
            throw new IOException("End of XML while looking for element [" +
              wantedName + "]");
            // break;
          case XMLStreamConstants.START_ELEMENT : // 1
            if(gotSTART_ELEMENT) {
              throw new IOException("START_ELEMENT [" +
                in.getName() +
                " event when expecting CHARACTERS event for [" +
                wantedName + "]");
            } else if(in.getName().toString().equals(wantedName)) {
              gotSTART_ELEMENT = true;
            } else {
              throw new IOException("unexpected element name [" +
                in.getName() + "], was expecting [" +
                wantedName + "]");
            }
            break;
          case XMLStreamConstants.COMMENT:
          case XMLStreamConstants.END_ELEMENT: // 2
          case XMLStreamConstants.SPACE:
          case XMLStreamConstants.START_DOCUMENT: // 7
            // these are in XML but we don't need them
            break;
          // these should never appear in edits XML
          case XMLStreamConstants.ATTRIBUTE:
          case XMLStreamConstants.CDATA:
          case XMLStreamConstants.DTD:
          case XMLStreamConstants.ENTITY_DECLARATION:
          case XMLStreamConstants.ENTITY_REFERENCE:
          case XMLStreamConstants.NAMESPACE:
          case XMLStreamConstants.NOTATION_DECLARATION:
          case XMLStreamConstants.PROCESSING_INSTRUCTION:
          default:
            throw new IOException("Unsupported event type [" +
              eventType + "] (see XMLStreamConstants)");
        }
        if(!in.hasNext()) { break; }
        eventType = in.next();
      }
    } catch(XMLStreamException e) {
      throw new IOException("Error reading XML stream", e);
    }
    throw new IOException(
      "Error reading XML stream, should never reach this line, " +
      "most likely XML does not have elements we are loking for");
  }
1191780
static String getElementText(Element element) {
        StringBuffer buf = new StringBuffer();

        NodeList children = element.getChildNodes();
        for (int i = 0; i < children.getLength(); i++) {
            Node node = children.item(i);
            if (node.getNodeType() == Node.TEXT_NODE ||
                    node.getNodeType() == Node.CDATA_SECTION_NODE) {
                Text text = (Text) node;
                buf.append(text.getData().trim());
            }
        }

        return buf.toString();
    }