コード例 #1
0
 @Override
 public void parseSource(WeixinData data, Node dom, Component component, String... strings) {
   if (component == null) return;
   NodeList nl = commonList(component.getXpath(), dom);
   if (nl == null) return;
   if (nl.item(0) != null) data.setSource(StringUtil.format(nl.item(0).getTextContent()));
 }
コード例 #2
0
 /**
  * 来源
  *
  * @param list
  * @param dom
  * @param component
  * @param strings
  */
 @Override
 public void parseSource(List<WeixinData> list, Node dom, Component component, String... strings) {
   if (component == null) return;
   NodeList nl = head(component.getXpath(), dom, list.size(), component.getName());
   if (nl == null) return;
   for (int i = 0; i < nl.getLength(); i++) {
     list.get(i).setSource(StringUtil.format(nl.item(i).getTextContent()));
   }
 }
コード例 #3
0
 @Override
 public void parseImgUrl(WeixinData data, Node dom, Component component, String... args) {
   if (component == null) return;
   NodeList nl = commonList(component.getXpath(), dom);
   if (nl == null) return;
   String imgs = "";
   for (int i = 0; i < nl.getLength(); i++) {
     imgs += StringUtil.format(nl.item(i).getTextContent()) + ";";
   }
   data.setImgUrl(imgs);
 }
コード例 #4
0
  @Override
  public void parseSource(NewsData data, Node dom, Component component, String... args) {
    String str = "";
    if (component == null) return;

    NodeList nl = commonList(component.getXpath(), dom);
    if (nl == null) return;

    if (nl.item(0) != null) str = StringUtil.format(nl.item(0).getTextContent());
    str = str.replace("来源:", "");
    str = str.equals("") ? "慧聪橡胶网" : str;
    str = str.length() > 20 ? "慧聪橡胶网" : str;
    data.setSource(str);
  }
コード例 #5
0
  @Override
  public void parseAuthor(NewsData data, Node dom, Component component, String... args) {
    String str = "";
    if (component == null) {
      return;
    }
    NodeList nl = commonList(component.getXpath(), dom);
    if (nl == null) {
      return;
    }
    if (nl.item(0) != null) str = StringUtil.format(nl.item(0).getTextContent());
    str = str.replace("●", "").trim();

    data.setSource(str);
  }
コード例 #6
0
  @Override
  public void parseSource(NewsData data, Node dom, Component component, String... args) {
    String str = "";
    if (component == null) return;

    NodeList nl = commonList(component.getXpath(), dom);
    if (nl == null) return;

    if (nl.item(0) != null) {
      str = nl.item(0).getTextContent();
      str = StringUtil.format(str);
    }
    if (str.contains("来源:")) str = str.substring(str.indexOf("来源:") + 3);
    if (str.contains("发布日期")) str = str.substring(0, str.indexOf("发布日期")).replace(" ", "").trim();
    if (str == null) str = "中国橡胶工业协会-轮胎分会";
    else {
      str = str.contains("本站") ? "中国橡胶工业协会-轮胎分会" : str;
    }
    str = str.length() > 20 ? "中国橡胶工业协会-轮胎分会" : str;
    data.setSource(str);
  }