本文整理了Java中org.apache.commons.lang3.StringEscapeUtils.unescapeXml()
方法的一些代码示例,展示了StringEscapeUtils.unescapeXml()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringEscapeUtils.unescapeXml()
方法的具体详情如下:
包路径:org.apache.commons.lang3.StringEscapeUtils
类名称:StringEscapeUtils
方法名:unescapeXml
[英]Unescapes a string containing XML entity escapes to a string containing the actual Unicode characters corresponding to the escapes.
Supports only the five basic XML entities (gt, lt, quot, amp, apos). Does not support DTDs or external entities.
Note that numerical \u Unicode codes are unescaped to their respective Unicode characters. This may change in future releases.
[中]unescape将包含XML实体转义的字符串转换为包含与转义相对应的实际Unicode字符的字符串。
仅支持五个基本XML实体(gt、lt、QUOTE、amp、apos)。不支持DTD或外部实体。
请注意,数字\u Unicode代码未转换为各自的Unicode字符。这在未来的版本中可能会发生变化。
代码示例来源:origin: springside/springside4
/**
* Xml转码,XML格式的字符串解码为普通字符串.
*
* 比如 "bread" & "butter" 转化为"bread" & "butter"
*/
public static String unescapeXml(String xml) {
return StringEscapeUtils.unescapeXml(xml);
}
代码示例来源:origin: gocd/gocd
private List<File> parseFiles(Element filesElement, String fileType) {
List files = filesElement.getChild(fileType).getChildren("file");
List<File> modifiedFiles = new ArrayList<>();
for (Iterator iterator = files.iterator(); iterator.hasNext();) {
Element node = (Element) iterator.next();
modifiedFiles.add(new File(org.apache.commons.lang3.StringEscapeUtils.unescapeXml(node.getText())));
}
return modifiedFiles;
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Reverse of the above.
*
* @see <a href="https://issues.apache.org/jira/browse/LANG-729">LANG-729</a>
*/
@Test
public void testUnescapeXmlSupplementaryCharacters() {
assertEquals("Supplementary character must be represented using a single escape", "\uD84C\uDFB4",
StringEscapeUtils.unescapeXml("𣎴") );
assertEquals("Supplementary characters mixed with basic characters should be decoded correctly", "a b c \uD84C\uDFB4",
StringEscapeUtils.unescapeXml("a b c 𣎴") );
}
代码示例来源:origin: gocd/gocd
private Modification parseChangeset(Element changeset) {
Date modifiedTime = DateUtils.parseRFC822(changeset.getChildText("date"));
String author = org.apache.commons.lang3.StringEscapeUtils.unescapeXml(changeset.getChildText("author"));
String comment = org.apache.commons.lang3.StringEscapeUtils.unescapeXml(changeset.getChildText("desc"));
String revision = changeset.getChildText("node");
Modification modification = new Modification(author, comment, null, modifiedTime, revision);
Element files = changeset.getChild("files");
List<File> modifiedFiles = parseFiles(files, "modified");
List<File> addedFiles = parseFiles(files, "added");
List<File> deletedFiles = parseFiles(files, "deleted");
modifiedFiles.removeAll(addedFiles);
modifiedFiles.removeAll(deletedFiles);
addModificationFiles(modification, ModifiedAction.added, addedFiles);
addModificationFiles(modification, ModifiedAction.deleted, deletedFiles);
addModificationFiles(modification, ModifiedAction.modified, modifiedFiles);
return modification;
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testStandaloneAmphersand() {
assertEquals("<P&O>", StringEscapeUtils.unescapeHtml4("<P&O>"));
assertEquals("test & <", StringEscapeUtils.unescapeHtml4("test & <"));
assertEquals("<P&O>", StringEscapeUtils.unescapeXml("<P&O>"));
assertEquals("test & <", StringEscapeUtils.unescapeXml("test & <"));
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testEscapeXml() throws Exception {
assertEquals("<abc>", StringEscapeUtils.escapeXml("<abc>"));
assertEquals("<abc>", StringEscapeUtils.unescapeXml("<abc>"));
"\u00A0", StringEscapeUtils.unescapeXml(" "));
assertEquals("XML should be able to unescape >0x7f values with one leading 0",
"\u00A0", StringEscapeUtils.unescapeXml(" "));
assertEquals("XML should be able to unescape >0x7f values with two leading 0s",
"\u00A0", StringEscapeUtils.unescapeXml(" "));
assertEquals("XML should be able to unescape >0x7f values with three leading 0s",
"\u00A0", StringEscapeUtils.unescapeXml(" "));
assertEquals("ain't", StringEscapeUtils.unescapeXml("ain't"));
assertEquals("ain't", StringEscapeUtils.escapeXml("ain't"));
assertEquals("", StringEscapeUtils.escapeXml(""));
assertNull(StringEscapeUtils.escapeXml(null));
assertNull(StringEscapeUtils.unescapeXml(null));
代码示例来源:origin: jobxhub/JobX
/**
* Xml 解码.
*/
public static String unescapeXml(String xmlEscaped) {
return StringEscapeUtils.unescapeXml(xmlEscaped);
}
代码示例来源:origin: xuminwlt/j360-dubbo-app-all
/**
* Xml转码,XML格式的字符串解码为普通字符串.
*
* 比如 "bread" & "butter" 转化为"bread" & "butter"
*/
public static String unescapeXml(String xml) {
return StringEscapeUtils.unescapeXml(xml);
}
代码示例来源:origin: com.centit.support/centit-utils
public static String decodeString(String xmlData)
{
return StringEscapeUtils.unescapeXml(xmlData);
/*String strData = xmlData.replaceAll("<", "<");
strData = strData.replaceAll( ">", ">");
strData = strData.replaceAll("'", "'");
strData = strData.replaceAll(""", "\"");
strData = strData.replaceAll( "&", "&");
return strData; */
}
代码示例来源:origin: com.quhaodian/user_hibernate
/**
* Xml 解码.
*/
public static String unescapeXml(String xmlEscaped) {
return StringEscapeUtils.unescapeXml(xmlEscaped);
}
代码示例来源:origin: tangyanbo/springmore
/**
* Xml 解码.
*/
public static String unescapeXml(String xmlEscaped) {
return StringEscapeUtils.unescapeXml(xmlEscaped);
}
代码示例来源:origin: com.quhaodian.discover/discover-user
/**
* Xml 解码.
*/
public static String unescapeXml(String xmlEscaped) {
return StringEscapeUtils.unescapeXml(xmlEscaped);
}
代码示例来源:origin: com.github.dactiv/dactiv-common
/**
* Xml 解码.
*/
public static String unescapeXml(String xmlEscaped) {
return StringEscapeUtils.unescapeXml(xmlEscaped);
}
代码示例来源:origin: lcw2004/one
/**
* Xml 解码.
*/
public static String unescapeXml(String xmlEscaped) {
return StringEscapeUtils.unescapeXml(xmlEscaped);
}
代码示例来源:origin: DarLiner/vjtools
/**
* Xml转码,XML格式的字符串解码为普通字符串.
*
* 比如 "bread" & "butter" 转化为"bread" & "butter"
*/
public static String unescapeXml(String xml) {
return StringEscapeUtils.unescapeXml(xml);
}
代码示例来源:origin: xautlx/s2jh4net
/**
* Xml 解码.
*/
public static String unescapeXml(String xmlEscaped) {
return StringEscapeUtils.unescapeXml(xmlEscaped);
}
代码示例来源:origin: tinyMediaManager/tinyMediaManager
/**
* Gets the proxy password.
*
* @return the proxy password
*/
@XmlElement(name = PROXY_PASSWORD)
@XmlJavaTypeAdapter(EncryptedStringXmlAdapter.class)
public String getProxyPassword() {
return StringEscapeUtils.unescapeXml(proxyPassword);
}
代码示例来源:origin: net.open-esb.admin/openesb-java-sdk
@Override
public String getComponentDescriptor(GetComponentDescriptorRequest request) throws OpenESBClientException {
return StringEscapeUtils.unescapeXml(
executeRequest(request,
null,
new StringResponseHandler()));
}
代码示例来源:origin: org.xworker/xworker_core
public static String unescapeXml(ActionContext actionContext){
Thing self = actionContext.getObject("self");
String str = (String) self.doAction("getStr", actionContext);
return StringEscapeUtils.unescapeXml(str);
}
代码示例来源:origin: net.open-esb.admin/openesb-java-sdk
@Override
public String getServiceAssemblyDescriptor(GetServiceAssemblyDescriptorRequest request) throws Exception {
return StringEscapeUtils.unescapeXml(
executeRequest(
request,
null,
new StringResponseHandler()));
}
内容来源于网络,如有侵权,请联系作者删除!