Returns an array of XML sub-elements with the specified attribute name.
768160
def findElementsByAttributeName( elements, attribute_name )
      elementArray = []
      if elements
         elements.each_element_with_attribute( attribute_name ) { |e|  elementArray << e }
      end
      elementArray
   end
433251
def xmlmetadata(self):
        """"""
        E = ElementMaker(namespace="http://ilk.uvt.nl/folia",nsmap={None: "http://ilk.uvt.nl/folia", 'xml' : "http://www.w3.org/XML/1998/namespace"})
        elements = []
        if self.metadatatype == "native":
            if isinstance(self.metadata, NativeMetaData):
                for key, value in self.metadata.items():
                    elements.append(E.meta(value,id=key) )
        else:
            if isinstance(self.metadata, ForeignData):
                #in-document
                m = self.metadata
                while m is not None:
                    elements.append(m.xml())
                    m = m.next
        for metadata_id, submetadata in self.submetadata.items():
            subelements = []
            attribs = {
                "{http://www.w3.org/XML/1998/namespace}id": metadata_id,
                "type": self.submetadatatype[metadata_id] }
            if isinstance(submetadata, NativeMetaData):
                for key, value in submetadata.items():
                    subelements.append(E.meta(value,id=key) )
            elif isinstance(submetadata, ExternalMetaData):
                attribs['src'] = submetadata.url
            elif isinstance(submetadata, ForeignData):
                #in-document
                m = submetadata
                while m is not None:
                    subelements.append(m.xml())
                    m = m.next
            elements.append( E.submetadata(*subelements, **attribs))
        return elements
578013
function(node, attributeName) {
			var out = [],
				attList;

			attList = node.getAttribute(attributeName);
			if(attList && attList !== '') {
				if(attList.indexOf(' ') > -1) {
					out = attList.split(' ');
				} else {
					out.push(attList);
				}
			}
			return out;
		}
188209
public AttributeList getAttributes(String[] attributes) {
    final AttributeList result = new AttributeList();
    for (String attributeName : attributes) {
      result.add(new Attribute(attributeName, getAttributeInternal(attributeName)));
    }
    return result;
  }
1216204
def getElements(self,name=''):
		''
		#If no tag name is specified, return the all children
		if not name:
			return self.children
		else:
			# else return only those children with a matching tag name
			elements = []
			for element in self.children:
				if element.name == name:
					elements.append(element)
			return elements
933400
def get_list_from_xml(elem, tag="option", attributes=["name"]):
    '''
    
    '''
    return flatten(([option.get(attr) for attr in attributes] + [option.text] for option in elem.findall(tag)), exclude=[None])
89056
public static Element[] getChildren( Element root, String name )
    {
        if( null == root )
        {
            return new Element[0];
        }
        NodeList list = root.getElementsByTagName( name );
        int n = list.getLength();
        ArrayList<Element> result = new ArrayList<Element>();
        for( int i = 0; i < n; i++ )
        {
            Node item = list.item( i );
            if( item instanceof Element )
            {
                result.add( (Element) item );
            }
        }
        Element[] retval = new Element[result.size()];
        result.toArray( retval );
        return retval;
    }
232194
public VoltXMLElement findChild(String elementName, String attributeName)
    {
        String attName = attributeName;
        if (attName == null) {
            attName = "default";
        }
        return findChild(elementName + attName);
    }
930007
public Properties getAttributes(Attributes attrs) {
        Properties attributes = new Properties();
        attributes.putAll(attributeValues);
        if (defaultContent != null) {
            attributes.put(ElementTags.ITEXT, defaultContent);
        }
        if (attrs != null) {
            for (int i = 0; i < attrs.getLength(); i++) {
                String attribute = getName(attrs.getQName(i));
                attributes.setProperty(attribute, attrs.getValue(i));
            }
        }
        return attributes;
    }
1152715
private static function array_to_xml($data = array(), &$xml_data) {
	foreach($data as $key => $value) {

	    if(is_array($value) or (is_object($value))) {
		if(!is_numeric($key)){
		    $subnode = $xml_data->addChild("$key");
		    self::array_to_xml($value, $subnode);
		}
		else{
		    $subnode = $xml_data->addChild("element");
		    self::array_to_xml($value, $subnode);
		}
	    }
	    else {
		if (is_bool($value)) {$value = $value ? "true" : "false";}
		$xml_data->addChild("$key","$value");
	    }
	}
    }
1144578
def xml(self, attribs = None,elements = None, skipchildren = False):
        """"""
        if not attribs: attribs = {}
        if self.idref:
            attribs['id'] = self.idref
        return super(AbstractTextMarkup,self).xml(attribs,elements, skipchildren)
917636
public static function xmlStrToArray($xmlString, $tagName = false, $elementCount = false)
    {
        $doc = new DOMDocument();
        try {
            $doc->loadXML($xmlString);
        } catch (Exception $exc) {
            return [];
        }
        $result = [];

        if (is_string($tagName)) {
            $nodes = $doc->documentElement->getElementsByTagName($tagName);
            if (false == $elementCount) {
                $elementCount = $nodes->length;
            }
            for ($i = 0; $i < $elementCount; $i++) {
                $result[] = self::domNodeToArray($nodes->item($i));
            }
        } else {
            $result = self::domNodeToArray($doc->documentElement);
        }

        return $result;
    }
89626
private static function xml2array(\SimpleXMLElement $xml)
    {
        $arr = [];

        if ($xml) {
            foreach ($xml->children() as $r) {
                $t = [];
                if (!is_null($r) && count($r->children()) == 0) {
                    $arr[$r->getName()] = strval($r);
                } else {
                    $arr[$r->getName()][] = self::xml2array($r);
                }
            }
        }

        return $arr;
    }
1334822
public Enumeration<String> getElements() {
        AttributeNameEnumeration elements = new AttributeNameEnumeration();
        elements.addElement(USAGES);

        return (elements.elements());
    }
348399
def Element(cls, s, *args):
        """"""
        sargs = []
        for arg in args:
            if type(arg) == etree._Element:
                sargs.append(etree.tounicode(arg))
            else:
                sargs.append(arg)
        if type(s) == etree._Element:
            t = etree.tounicode(s)
        else:
            t = s
        if len(args) == 0:
            return XML.fromstring(t)
        else:
            return XML.fromstring(t % tuple(sargs))
237670
def element_for_attribute(name, namespace='')
      val = instance_values[name]
      return "" if val == nil
      "<%s:%s val='%s'/>" % [namespace, Axlsx::camel(name, false), val]
    end
330230
private static List<XsdAttribute> filterAttributes(List<XsdAttribute> attributes) {
        List<String> attributeNames = attributes.stream()
                .map(XsdNamedElements::getName)
                .distinct()
                .collect(Collectors.toList());

        List<XsdAttribute> filteredAttributes = new ArrayList<>();

        attributeNames.forEach(attributeName -> {
            for (XsdAttribute attribute : attributes) {
                if (attribute.getName().equals(attributeName)){
                    filteredAttributes.add(attribute);
                    break;
                }
            }
        });

        return filteredAttributes;
    }