本文整理了Java中org.apache.commons.lang.StringEscapeUtils.unescapeXml()
方法的一些代码示例,展示了StringEscapeUtils.unescapeXml()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringEscapeUtils.unescapeXml()
方法的具体详情如下:
包路径:org.apache.commons.lang.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: pentaho/pentaho-kettle
/**
* UnEscape XML content. i.e. replace characters with &values;
*
* @param content
* content
* @return unescaped content
*/
public static String unEscapeXml( String content ) {
if ( Utils.isEmpty( content ) ) {
return content;
}
return StringEscapeUtils.unescapeXml( content );
}
代码示例来源:origin: spotbugs/spotbugs
s = sUnescaped.toString();
return StringEscapeUtils.unescapeXml(s);
代码示例来源:origin: internetarchive/heritrix3
public static long processXml(Extractor ext,
CrawlURI curi, CharSequence cs) {
long foundLinks = 0;
Matcher matcher = XML_URI_EXTRACTOR.matcher(cs);
while (matcher.find()) {
String xmlUri = StringEscapeUtils.unescapeXml(matcher.group(1));
if (UriUtils.isVeryLikelyUri(xmlUri)) {
foundLinks++;
try {
// treat as speculative, as whether context really
// intends to create a followable/fetchable URI is
// unknown
int max = ext.getExtractorParameters().getMaxOutlinks();
addRelativeToBase(curi, max, xmlUri,
LinkContext.SPECULATIVE_MISC, Hop.SPECULATIVE);
} catch (URIException e) {
// There may not be a controller (e.g. If we're being run
// by the extractor tool).
ext.logUriError(e, curi.getUURI(), xmlUri);
}
}
}
return foundLinks;
}
代码示例来源:origin: youseries/urule
String content=element.attributeValue("content");
if(StringUtils.isNotEmpty(content)){
sv.setContent(StringEscapeUtils.unescapeXml(content));
代码示例来源:origin: org.zaproxy/zap
/**
*
* @param value
* @return
*/
@Override
public String getUnescapedValue(String value) {
return StringEscapeUtils.unescapeXml(value);
}
代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz
private static String decodeEscXml(final String decodeText) {
return StringEscapeUtils.unescapeXml(decodeText);
}
代码示例来源:origin: perfectsense/dari
public static String unescapeXml(String string) {
return string == null ? null : StringEscapeUtils.unescapeXml(string);
}
代码示例来源:origin: yuboon/Aooms
public static String unescapeXss(String str) {
return StringEscapeUtils.unescapeXml(str);
}
代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.gateway
private String processSequenceXml(String sequence) {
if (StringUtils.isEmpty(sequence)) {
return null;
}
String processedSequence = StringEscapeUtils.unescapeXml(sequence);
return processedSequence;
}
代码示例来源:origin: GeeQuery/ef-orm
/**
* 获得属性值
*
* @param e
* 元素节点
* @param attributeName
* 属性名
* @return 属性值。xml转义符会被还原;两端空格会被截去。
*/
public static String attrib(Element e, String attributeName) {
if (!e.hasAttribute(attributeName))
return null;
String text = e.getAttribute(attributeName);
return (text == null) ? null : StringEscapeUtils.unescapeXml(text.trim());
}
代码示例来源:origin: youseries/uflo
protected String unescape(String str){
if(StringUtils.isEmpty(str))return str;
str=StringEscapeUtils.escapeXml(str);
return StringEscapeUtils.unescapeXml(str);
}
}
代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-basic-transformers
@Override
public String[] transform(InputRow inputRow) {
final String value = inputRow.getValue(column);
if (value == null) {
return new String[1];
}
final String unescaped = StringEscapeUtils.unescapeXml(value);
return new String[] { unescaped };
}
代码示例来源:origin: datacleaner/DataCleaner
@Override
public String[] transform(final InputRow inputRow) {
final String value = inputRow.getValue(column);
if (value == null) {
return new String[1];
}
final String unescaped = StringEscapeUtils.unescapeXml(value);
return new String[] { unescaped };
}
代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl
public String escapeXml(String url){
return StringEscapeUtils.escapeXml(StringEscapeUtils.unescapeXml(url));
}
}
代码示例来源:origin: com.bstek.uflo/uflo-core
protected String unescape(String str){
if(StringUtils.isEmpty(str))return str;
str=StringEscapeUtils.escapeXml(str);
return StringEscapeUtils.unescapeXml(str);
}
}
代码示例来源:origin: enix12enix/sikuli-remote-control
public static Exception retriveError(Document doc) throws Exception {
NodeList excepts = doc.getElementsByTagName("exception");
if (excepts.getLength() == 0) {
return null;
}
String exceptName = excepts.item(0).getFirstChild().getNodeValue();
Class<?> clz = Class.forName(exceptName);
NodeList messages = doc.getElementsByTagName("message");
if (messages.getLength() == 0) {
return (Exception) clz.newInstance();
} else {
Constructor<?> con = clz.getConstructor(String.class);
return (Exception) con.newInstance(StringEscapeUtils.unescapeXml(messages.item(0).getFirstChild().getNodeValue()));
}
}
代码示例来源:origin: pentaho/data-access
static String prepareDataSourceInfo( String dataSourceInfo ) {
StringBuilder sb = new StringBuilder();
Map<String, String> parameters = DataSourceInfoUtil.parseDataSourceInfo( dataSourceInfo );
parameters.forEach( ( key, value ) -> {
String unescapedValue = StringEscapeUtils.unescapeXml( value );
String valueWithEscapedQuotes = DataSourceInfoUtil.escapeQuotes( unescapedValue );
sb.append( key );
sb.append( "=\"" );
sb.append( valueWithEscapedQuotes );
sb.append( "\"" );
sb.append( ";" );
} );
return sb.toString();
}
代码示例来源:origin: org.apache.axis2.transport/axis2-transport-xmpp
/**
* This method will be triggered, when a message is arrived at client side
*/
public void processPacket(Packet packet) {
Message message = (Message)packet;
String xml = StringEscapeUtils.unescapeXml(message.getBody());
log.info("Client received message : "+xml);
this.responseReceived = true;
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
messageContext.setProperty(MessageContext.TRANSPORT_IN, inputStream);
}
代码示例来源:origin: apache/axis2-java
/**
* This method will be triggered, when a message is arrived at client side
*/
public void processPacket(Packet packet) {
Message message = (Message)packet;
String xml = StringEscapeUtils.unescapeXml(message.getBody());
log.info("Client received message : "+xml);
this.responseReceived = true;
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
messageContext.setProperty(MessageContext.TRANSPORT_IN, inputStream);
}
代码示例来源:origin: jenkinsci/warnings-plugin
private List<FileAnnotation> parseProblems(List<Element> elements) {
List<FileAnnotation> problems = Lists.newArrayList();
for (Element element : elements) {
String file = getChildValue(element, "file");
int line = Integer.parseInt(getChildValue(element, "line"));
Element problemClass = XmlElementUtil.getFirstElementByTagName(element, "problem_class");
String severity = problemClass.getAttribute("severity");
String category = StringEscapeUtils.unescapeXml(getValue(problemClass));
String description = StringEscapeUtils.unescapeXml(getChildValue(element, "description"));
problems.add(createWarning(file, line, category, description, getPriority(severity)));
}
return problems;
}
内容来源于网络,如有侵权,请联系作者删除!