当前位置: 首页>>代码示例>>Java>>正文


Java DataNode.getWholeData方法代码示例

本文整理汇总了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++;
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:27,代码来源:Cleaner.java

示例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);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:29,代码来源:HeadCleaner.java

示例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;
}
 
开发者ID:YangHanqing,项目名称:HfutHelper_Android,代码行数:37,代码来源:LibraryTools.java

示例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);
  }
}
 
开发者ID:PolymerLabs,项目名称:PolymerRenamer,代码行数:28,代码来源:HtmlRenamer.java


注:本文中的org.jsoup.nodes.DataNode.getWholeData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。