xpath_selector 3.0.2

SDKdartflutter
Platformandroidioswindowslinuxmacosweb

XPath package for HTML and XML, basic XPath syntax are supported.

xpath_selector

Pub

An XPath selector for locating Html and Xml elements

English | 简体中文

Parser

This library is for xpath selection only, you must define a parser, and here is my prebuilt parser:

If you want to use another parser, refer to these two libraries to define your own parser that implements the XPathNode<T> interface

Extended syntax

In the attribute selector, the parser extends the following attribute selector in CSS style

ExpressionCssDescription
[@attr='value'][attr="value"]Selects all elements with attr="value"
[@attr~='value'][attr~="value"]Selects all elements attribute containing the word "value"
[@attr^='value'][attr^="value"]Selects all elements whose attr attribute value begins with "value"
[@attr$='value'][attr$="value"]Selects all elements whose attr attribute value ends with "value"
[@attr*='value'][attr*="value"]Selects all elements whose attr attribute value contains the substring "value"

Breaking changes

1.x => 2.0

  1. Remove classXPathElement, which merge toXPathNode
  2. In XPathResult, elements=>nodes, elements=>element

2.0 => 3.0

  1. Remove the built-in html and xlm parsers, and make it independent to xpath_selector_html_parser and xpath_selector_xml_parser