Htmlparser of reading Code

Source: Internet
Author: User

In the previous use of Htmlparser, did not consider the encounter org.htmlparser.tags outside the tag how to handle. Until a label like this is encountered, Htmlparser cannot process it if it is not processed. Check the custom label only then understand, control Htmlparser parsing page structure is, Prototypicalnodefactory implements Nodefactory. Each tag needs to be registered in Nodefactory (Registertag ()). All tags in the org.htmlparser.tags are registered by default. If you have a custom tag, register it inside. Custom labels can be extends Compositetag. Subclasses must implement the string[] GetIDs () method, which provides an instance of the class at the time of registration. Prototypicalnodefactory saved a map<string, node> Key is the name of the tag, which is the GetIDs () method returned by the string[]. Value is the instance provided at the time of registration. During the Htmlparser parsing process, the Clone () method of the instance is invoked to construct a node.

This is the first time I have seen the use of the Clone method in Java. Specific Clone () method of the call, and then look at the book it.

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.