Org.html parser. util. parserexception: Error in opening a connection

Source: Internet
Author: User
Tags lexer

An error occurred while using htmlparser.

Org.html parser. util. parserexception: Error in opening a connection

Java. Io. ioexception: invalid argument

At java. Io. winntfilesystem. canonicalize0 (native method)

At java. Io. win32filesystem. canonicalize (win32filesystem. Java: 396)

At java. Io. file. GetCanonicalPath (file. Java: 559)

At org.html parser. http. connectionmanager. openconnection (connectionmanager. Java: 774)

At org.html partser. parser. <init> (parser. Java: 304)

At org.html partser. parser. <init> (parser. Java: 316)

At tentsoft. util. cnlinkinfparser. docnlinkinfparser (cnlinkinfparser. Java: 62)

At tentsoft. util. cnlinkinfparser. getcnlinklist (cnlinkinfparser. Java: 111)

At tentsoft. util. cnlinkinfparser. Main (cnlinkinfparser. Java: 138)

View carefullySource code, Found in
Myparser = new Parser (htmlbody); this sentence has an error

The htmlbody is the response obtained from a request to a website. The type is string.
But an error is reported.
Finally, define a method

/**
* Parse strings
* @ Param inputhtml string
* @ Return parser
*/
Public static parser createparser (string inputhtml ){
Lexer mlexer = new lexer (New Page (inputhtml ));
Return new Parser (mlexer,
New defaultparserfeedback (defaultparserfeedback. Quiet ));
}

Create new Parser () in createparser.
Solve the problem. The above myparser = new Parser (htmlbody) Statement is changed to myparser = createparser (htmlbody ).

this article from the csdn blog, reprint please indicate the source: http://blog.csdn.net/rudyMatrix/archive/2007/11/18/1891663.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.