本文整理汇总了Java中org.apache.commons.text.StringEscapeUtils.unescapeXml方法的典型用法代码示例。如果您正苦于以下问题:Java StringEscapeUtils.unescapeXml方法的具体用法?Java StringEscapeUtils.unescapeXml怎么用?Java StringEscapeUtils.unescapeXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.text.StringEscapeUtils
的用法示例。
在下文中一共展示了StringEscapeUtils.unescapeXml方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkStyleCSS
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
final private void checkStyleCSS(TagNode node)
throws ClientProtocolException, IllegalStateException, IOException, SearchLibException, URISyntaxException {
if (!("style".equalsIgnoreCase(node.getName())))
return;
String attr = node.getAttributeByName("type");
if (!StringUtils.isEmpty(attr) && !"text/css".equalsIgnoreCase(attr))
return;
attr = node.getAttributeByName("media");
if (!StringUtils.isEmpty(attr) && !"screen".equalsIgnoreCase(attr) && !"all".equalsIgnoreCase(attr))
return;
StringBuilder builder = (StringBuilder) node.getText();
if (builder == null)
return;
String content = builder.toString();
String newContent = StringEscapeUtils.unescapeXml(content);
StringBuffer sb = checkCSSContent(baseUrl, newContent);
if (sb != null)
newContent = sb.toString();
if (newContent.equals(content))
return;
node.removeAllChildren();
node.addChild(new ContentNode(newContent));
}
示例2: checkScriptContent
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
final private void checkScriptContent(TagNode node, Set<TagNode> disableScriptNodeSet) {
if (!("script".equalsIgnoreCase(node.getName())))
return;
if (disableScriptNodeSet != null && hasAncestorXPath(disableScriptNodeSet, node)) {
node.removeFromTree();
return;
}
StringBuilder builder = (StringBuilder) node.getText();
if (builder == null)
return;
String content = builder.toString();
if (content == null)
return;
String newContent = StringEscapeUtils.unescapeXml(content);
if (newContent.equals(content))
return;
node.removeAllChildren();
node.addChild(new ContentNode(newContent));
}
示例3: load
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
public void load(Node parentNode) throws XPathExpressionException {
synchronized (this) {
if (parentNode == null)
return;
List<Node> nodeList = DomUtils.getNodes(parentNode, "link");
for (Node node : nodeList) {
String sourceName = StringEscapeUtils.unescapeXml(DomUtils.getAttributeText(node, "source"));
S source = loadSource(sourceName);
if (source == null)
continue;
String targetName = DomUtils.getAttributeText(node, "target");
T target = loadTarget(targetName, node);
if (target == null)
continue;
add(source, target);
}
}
}
示例4: CommonFieldTarget
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
public CommonFieldTarget(String targetName, Node targetNode) {
super(targetName);
removeTag = false;
convertHtmlEntities = false;
List<Node> nodeList = DomUtils.getNodes(targetNode, "filter");
for (Node node : nodeList) {
if ("yes".equalsIgnoreCase(DomUtils.getAttributeText(node, "removeTag")))
removeTag = true;
if ("yes".equalsIgnoreCase(DomUtils.getAttributeText(node, "convertHtmlEntities")))
convertHtmlEntities = true;
if ("yes".equalsIgnoreCase(DomUtils.getAttributeText(node, "filePath")))
filePath = true;
filePathPrefix = DomUtils.getAttributeText(node, "filePathPrefix");
if ("yes".equalsIgnoreCase(DomUtils.getAttributeText(node, "crawlUrl")))
crawlUrl = true;
List<Node> nl = DomUtils.getNodes(node, "findRegexpTag");
if (nl.size() > 0)
findRegexpTag = StringEscapeUtils.unescapeXml(nl.get(0).getTextContent());
nl = DomUtils.getNodes(node, "replaceRegexpTag");
if (nl.size() > 0)
replaceRegexpTag = StringEscapeUtils.unescapeXml(nl.get(0).getTextContent());
checkRegexpPattern();
}
}
示例5: postAcceptFriendInvitation
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public void postAcceptFriendInvitation(Message message) throws IOException {
logger.info("postAcceptFriendInvitation");
// 将该用户的微信号设置成他的昵称
String content = StringEscapeUtils.unescapeXml(message.getContent());
ObjectMapper xmlMapper = new XmlMapper();
FriendInvitationContent friendInvitationContent = xmlMapper.readValue(content, FriendInvitationContent.class);
wechatHttpService.setAlias(message.getRecommendInfo().getUserName(), friendInvitationContent.getFromusername());
}
示例6: unescape
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
private static String unescape(String s) {
String tmp = s;
while (isEscaped(tmp)) {
tmp = StringEscapeUtils.unescapeXml(tmp);
}
return tmp;
}
示例7: ParserFieldTarget
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
public ParserFieldTarget(String name, Node node) {
super(name, node);
List<Node> nl = DomUtils.getNodes(node, "captureRegexp");
if (nl.size() > 0)
captureRegexp = StringEscapeUtils.unescapeXml(nl.get(0).getTextContent());
nl = DomUtils.getNodes(node, "removeTag");
removeTag = nl != null && nl.size() > 0;
nl = DomUtils.getNodes(node, "convertHtmlEntities");
convertHtmlEntities = nl != null && nl.size() > 0;
checkRegexpPattern();
}
示例8: getAttributeString
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
private final static String getAttributeString(Node node,
String attributeName, boolean unescapeXml) {
NamedNodeMap attr = node.getAttributes();
if (attr == null)
return null;
Node n = attr.getNamedItem(attributeName);
if (n == null)
return null;
String t = n.getTextContent();
if (t == null)
return null;
return unescapeXml ? StringEscapeUtils.unescapeXml(t) : t;
}
示例9: unescape
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
public static String unescape(String s) throws UnsupportedEncodingException {
return StringEscapeUtils.unescapeXml(StringEscapeUtils.unescapeHtml4(URLDecoder.decode(s, "UTF-8")));
}
示例10: BoostQuery
import org.apache.commons.text.StringEscapeUtils; //导入方法依赖的package包/类
private BoostQuery(Node node) {
query = StringEscapeUtils.unescapeXml(DomUtils.getText(node));
boost = XPathParser.getAttributeFloat(node, BOOSTQUERY_ATTR_BOOST);
}