Coder Social home page Coder Social logo

List属性解析失败 about gecco HOT 3 CLOSED

aimilin6688 avatar aimilin6688 commented on August 20, 2024
List属性解析失败

from gecco.

Comments (3)

xtuhcy avatar xtuhcy commented on August 20, 2024

这个问题是因为如果使用tr,td但是没有table包围,不符合html规范,jsoup会自动做一个转换。这个问题正在想办法处理

from gecco.

aimilin6688 avatar aimilin6688 commented on August 20, 2024

我临时是这么处理的

public HtmlParser(String baseUri, String content) {
        long beginTime = System.currentTimeMillis();
        log = LogFactory.getLog(HtmlParser.class);
        this.baseUri = baseUri;
        if (StringUtils.startsWithAny(content, "<tr", "<tr ")) {
            this.document = Jsoup.parse(content, baseUri, Parser.xmlParser());
        } else {
            this.document = Jsoup.parse(content, baseUri);
        }
        long endTime = System.currentTimeMillis();
        if (log.isTraceEnabled()) {
            log.trace("init html parser : " + (endTime - beginTime) + "ms");
        }
    }

from gecco.

xtuhcy avatar xtuhcy commented on August 20, 2024

已经解决,基本沿用你的思路,改成真正表达式。

from gecco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.