去除HTML标签中的属性

@param content 文本
@param attrs 属性名（不区分大小写）
@return 处理后的文本
435678
public static String removeHtmlAttr(String content, String... attrs) {
		String regex = null;
		for (String attr : attrs) {
			regex = StrUtil.format("(?i)\\s*{}=([\"']).*?\\1", attr);
			content = content.replaceAll(regex, StrUtil.EMPTY);
		}
		return content;
	}
934274
public function getContentsByAttr($attr, $attr_value) {
        $nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
        
        $contents = [];
        
        foreach ($nodes as $node) {
            array_push($contents, $node->nodeValue);
        }
        
        return $contents;
    }
7668
public static String unwrapHtmlTag(String content, String... tagNames) {
		return removeHtmlTag(content, false, tagNames);
	}
213776
public function render($name = '', $content = '', array $attrs = array(), $type = 'submit')
    {
        $attrs = array_merge(array('text' => null, 'name' => $name), $attrs);

        $attrs = $this->_getBtnClasses($attrs);
        $attrs['type'] = $type;

        if (Arr::key('icon', $attrs)) {
            $content = '<i class="' . $this->_icon . '-' . $attrs['icon'] . '"></i> ' . $this->_translate($content);
            unset($attrs['icon']);
        }

        return '<button ' . $this->buildAttrs($attrs) . '>' . $content . '</button>';
    }
425020
private static function getAttributes($attr)
    {
        $html = "";
        foreach ($attr as $key => $value) {
            $html .= $key . '="' . $value . '" ';
        }

        return $html;
    }
59929
@Override
    public String convert(String content) {
        StringWriter writer = new StringWriter();
        HtmlDocumentBuilder builder = new HtmlDocumentBuilder(writer);
        builder.setEmitAsDocument(false);
        parser.setBuilder(builder);

        parser.parse(content);
        parser.setBuilder(null);
        return writer.toString();
    }
548594
function(tagName, attributes, content) {
      var el = document.createElement(tagName);
      if (attributes) {
        Parse.$(el).attr(attributes);
      }
      if (content) {
        Parse.$(el).html(content);
      }
      return el;
    }
614546
def content(self, name, attrs=None, characters=None):
    
    with self.no_inner_space(outer=True):
      with self.element(name, attrs):
        if characters:
          self.characters(characters)
1134738
public static function element( $element, array $attribs = array(), $content = '' ) {
		return self::rawElement( $element, $attribs, strtr( $content, array(
			'&' => '&amp;',
			'<' => '&lt;',
		) ) );
	}
1228546
public static function btn($href, $content, $attr = ['class' => 'btn btn-default'], $params = array('tag' => 'a', 'attrHref' => 'href'))
    {
        $params = Arr::mergeWithDefaultParams($params);

        if(preg_match('/^fa-/', $content)){
            $content = "<i class=\"fa ".$content.'"></i>';
        } elseif(preg_match('/^glyphicon-/', $content)){
            $content = "<i class=\"glyphicon ".$content.'"></i>';
        }

        return '<'.$params['tag'].' '.$params['attrHref'].'="'.$href.'" '. Html::attributes($attr) .'>'.$content.'</'.$params['tag'].'>';
    }
976009
public String getStr(String attr) {
		// return (String)attrs.get(attr);
		Object s = attrs.get(attr);
		return s != null ? s.toString() : null;
	}
1166624
private Attributes toAttributes(Map<String,String> attrs){
        AttributesImpl impl = new AttributesImpl();
        for (Map.Entry<String,String> attr : attrs.entrySet()){
        	impl.addAttribute("", attr.getKey(), "", "CDATA", attr.getValue());
        }
        return impl;
    }
168794
public static function tr(
        string $content = null, 
        array $attributes = []
    ) : string
    {
        return self::tag("tr", $content, $attributes);
    }
667100
protected String getElementAttribute(Element element, String attrName)
    {
        Attr attr = element.getAttributeNode(attrName);
        return attr != null ? attr.getValue() : null;
    }
610586
def content_tag(tag, content, **options)
      attrs = options.map { |kind, value| %{ #{kind}="#{value}"} }.join
      "<#{tag}#{attrs}>#{content}</#{tag}>"
    end
602774
public static function table(
        string $content = null, 
        array $attributes = []
    ) : string
    {
        return self::tag("table", $content, $attributes);
    }
130880
public static String tagHtmlContent(String tag, String... content) {
		return openTagHtmlContent(tag, null, null, content) + closeTag(tag);
	}