org.jdom2.output.Format.escapeAttribute()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.jdom2.output.Format.escapeAttribute()方法的一些代码示例,展示了Format.escapeAttribute()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Format.escapeAttribute()方法的具体详情如下:
包路径:org.jdom2.output.Format
类名称:Format
方法名:escapeAttribute

Format.escapeAttribute介绍

[英]This will take the three pre-defined entities in XML 1.0 ('<', '>', and '&' - used specifically in XML elements) as well as CR/NL, tabs, and Quote characters which require escaping inside Attribute values and converts their character representation to the appropriate entity reference suitable for XML attribute content. Further, some special characters (e.g. characters that are not valid in the current encoding) are converted to escaped representations.
[中]这将采用XML 1.0中的三个预定义实体(“<”、“>”和“&”-专门用于XML元素)以及CR/NL、制表符和引号字符,这些字符需要在属性值内部转义,并将其字符表示形式转换为适合XML属性内容的适当实体引用。此外,一些特殊字符(例如,在当前编码中无效的字符)被转换为转义表示。

代码示例

代码示例来源:origin: org.jdom/jdom

write(out, Format.escapeAttribute(fstack.getEscapeStrategy(), value));

代码示例来源:origin: org.apache.jspwiki/jspwiki-main

protected void attributeEscapedEntitiesFilter(final Writer out,
                       final FormatStack fstack, final String value) throws IOException {
  write(out, Format.escapeAttribute(fstack.getEscapeStrategy(), value));
}

相关文章