xpath_parse 1.0.2

  • Readme
  • Changelog
  • Installing
  • 78

xpath #

Pub support
XPath selector based on html.

Get started #

Add dependency #

dependencies:
  xpath_parse: lastVersion

Super simple to use #

final String html = '''
<html>
<div><a href='https://github.com'>github.com</a></div>
<div class="head">head</div>
<table><tr><td>1</td><td>2</td><td>3</td><td>4</td></tr></table>
<div class="end">end</div>
</html>
''';

XPath.source(html).query("//div/a/text()").list()

more simple refer to this

Syntax supported: #

Name Expression
immediate parent /
parent //
attribute [@key=value]
nth child tag[n]
attribute /@key
wildcard in tagname /*
function function()

Extended syntax supported: #

These XPath syntax are extended only in Xsoup (for convenience in extracting HTML, refer to Jsoup CSS Selector):

Name Expression Support
attribute value not equals [@key!=value] yes
attribute value start with [@key~=value] yes
attribute value end with [@key$=value] yes
attribute value contains [@key*=value] yes
attribute value match regex [@key~=value] yes

[1.0.0] - xpath package create #

[1.0.1] - add method comment #

[1.0.2] - fix Health suggestions #

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  xpath_parse: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:xpath_parse/token_kind.dart';
import 'package:xpath_parse/xpath_parser.dart';
import 'package:xpath_parse/xpath_selector.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
61
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
78
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • xpath_parse that is a package requiring null.

Health suggestions

Format lib/token_kind.dart.

Run flutter format to format lib/token_kind.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and xpath_parse.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
flutter 0.0.0
html ^0.14.0+3 0.14.0+3
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
csslib 0.16.1
meta 1.1.8 1.2.2
path 1.7.0
sky_engine 0.0.99
source_span 1.7.0
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test