本文整理汇总了Java中org.jsoup.nodes.DataNode.getWholeData方法的典型用法代码示例。如果您正苦于以下问题:Java DataNode.getWholeData方法的具体用法?Java DataNode.getWholeData怎么用?Java DataNode.getWholeData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jsoup.nodes.DataNode
的用法示例。
在下文中一共展示了DataNode.getWholeData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: head
import org.jsoup.nodes.DataNode; //导入方法依赖的package包/类
public void head(Node source, int depth) {
if (source instanceof Element) {
Element sourceEl = (Element) source;
if (whitelist.isSafeTag(sourceEl.tagName())) { // safe, clone and copy safe attrs
ElementMeta meta = createSafeElement(sourceEl);
Element destChild = meta.el;
destination.appendChild(destChild);
numDiscarded += meta.numAttribsDiscarded;
destination = destChild;
} else if (source != root) { // not a safe tag, so don't add. don't count root against discarded.
numDiscarded++;
}
} else if (source instanceof TextNode) {
TextNode sourceText = (TextNode) source;
TextNode destText = new TextNode(sourceText.getWholeText());
destination.appendChild(destText);
} else if (source instanceof DataNode && whitelist.isSafeTag(source.parent().nodeName())) {
DataNode sourceData = (DataNode) source;
DataNode destData = new DataNode(sourceData.getWholeData());
destination.appendChild(destData);
} else { // else, we don't care about comments, xml proc instructions, etc
numDiscarded++;
}
}
示例2: head
import org.jsoup.nodes.DataNode; //导入方法依赖的package包/类
public void head(Node source, int depth) {
if (skipChildren) {
return;
}
if (source instanceof Element) {
Element sourceElement = (Element) source;
if (isSafeTag(sourceElement)) {
String sourceTag = sourceElement.tagName();
Attributes destinationAttributes = sourceElement.attributes().clone();
Element destinationChild = new Element(Tag.valueOf(sourceTag), sourceElement.baseUri(), destinationAttributes);
destination.appendChild(destinationChild);
destination = destinationChild;
} else if (source != root) {
skipChildren = true;
}
} else if (source instanceof TextNode) {
TextNode sourceText = (TextNode) source;
TextNode destinationText = new TextNode(sourceText.getWholeText(), source.baseUri());
destination.appendChild(destinationText);
} else if (source instanceof DataNode && isSafeTag(source.parent())) {
DataNode sourceData = (DataNode) source;
DataNode destinationData = new DataNode(sourceData.getWholeData(), source.baseUri());
destination.appendChild(destinationData);
}
}
示例3: getLocationFromText
import org.jsoup.nodes.DataNode; //导入方法依赖的package包/类
public static String getLocationFromText(String text) {
if (text == null) {
return null;
}
String location = null;
String strWZxxxxxx = null;
String strMsg = null;
Document doc = Jsoup.parse(text);
Elements scriptTags = doc.getElementsByTag("script");
String nodeStr = null;
for (Element tag : scriptTags) {
for (DataNode node : tag.dataNodes()) {
nodeStr = node.getWholeData();
System.out.println("node:" + node);
}
}
for (String str : nodeStr.split("\n")) {
System.out.println("str:" + str);
if (str.contains("strWZxxxxxx") && str.contains("|")) {
strWZxxxxxx = ((str.split("\\|"))[1].split("\""))[0];
System.out.println(strWZxxxxxx);
} else if (str.contains("strMsg")) {
strMsg = (str.split("\""))[1];
System.out.println(strMsg);
break;
}
}
if (strMsg != null&&!TextUtils.isEmpty(strMsg)) {
location = strMsg;
} else{
location = strWZxxxxxx;
}
return location;
}
示例4: head
import org.jsoup.nodes.DataNode; //导入方法依赖的package包/类
@Override
public void head(Node node, int depth) {
if (node instanceof Element) {
Element element = (Element) node;
String tagName = element.tag().getName();
if (tagName.equals(HtmlTags.POLYMER_ELEMENT.getName())) {
renameAttributesAttributeValue(element);
} else if (tagName.equals("script")) {
insideScriptElement = true;
} else {
renameAllAnnotatedEventAttributes(element);
renameAllAttributeValues(element);
}
} else if (node instanceof TextNode) {
TextNode textNode = (TextNode) node;
textNode.text(renameStringWithDatabindingDirectives(textNode.getWholeText()));
} else if (insideScriptElement && node instanceof DataNode) {
DataNode dataNode = (DataNode) node;
String js = dataNode.getWholeData();
try {
js = JsRenamer.renameProperties(renameMap, js);
} catch (JavaScriptParsingException e) {
System.err.println(e);
}
dataNode.setWholeData(js);
}
}