Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

向 webmagic-saxon 组件提供若干新 API,更优雅更灵活更强大 #1108

Merged
merged 4 commits into from Feb 10, 2023

Conversation

hooyantsing
Copy link
Contributor

依照 webmagic-core 组件里基于 jsoup 类结构实现的 Selector 编写
对照:
webmagic-core: (I)Selector,(I)ElementSelector -> (A)BaseElementSelector -> (C)XpathSelector
webmagic-saxon: (I)Selector,(I)NodeSelector -> (C)Xpath2Selector

更优雅

旧:String name = new Xpath2Selector("//div/span/text()").select(html);
新:String name = Xpath2Selector.newInstance("//div/span/text()").select(html);

更灵活(新API)

select(String) / selectList(String) / selectNode(String) / selectNodes(String)
select(Node) / selectList(Node) / selectNode(Node) / selectNodes(Node)

更强大(新工具)

  • JaxpSelectorUtils

@sutra sutra merged commit 7179311 into code4craft:develop Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants