Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Jsoup Annotations POJO

License

NotificationsYou must be signed in to change notification settings

fcannizzaro/jsoup-annotations

Repository files navigation

Jsoup Annotations POJO

Build StatusAndroid ArsenalCodacy Badge

Gradle Dependency

Step 1.

Add the JitPack repository to your build file

allprojects {    repositories {...      maven { url'https://jitpack.io' }    }  }

Step 2.

Add the dependency

dependencies {    compile'com.github.fcannizzaro:jsoup-annotations:1.0.3'  }

Usage

Elementhtml =Jsoup.connect("https://www.npmjs.com/").get();/**  Scrape!*  Use JsoupProcessor or JP*/NPMnpm =JP.from(html,NPM.class);// orList<Package>packages =JP.fromList(html,Package.class);

SeeSample Code

Annotations

@Selector(String: query)

Can be used for class or field.

@Selector("#content")classContent {// internal elements}

@Text(String: query)

@Text("h3")Stringtitle;

@Html(String: query)

@Html("div.inner")Stringhtml;

@Attr(String: query, String: attr)

@Attr(query="a",attr="href")Stringhref;

Text,Html,Attr can be also attached to methods like:

@Text("head > title")voidtitle(Stringtitle){// do something with result}

@ForEach(String: query)

@ForEach("li")voiditerate(Elementelement,intindex){// [required] element// [optional] index// do something}

@AfterBind

@AfterBindvoidattached(){// called after object binding is completed.}

@Child

DenoteField as child element (POJO).

@Items

DenoteField as List of Elements (POJO).

Author

Francesco Cannizzaro (fcannizzaro)

License

Copyright 2017 Francesco Saverio CannizzaroLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

[8]ページ先頭

©2009-2026 Movatter.jp