Skip to content

xpathqs/core

Repository files navigation

CI/CD Maven Central GitHub top language codecov License EO principles respected here

logo

XpathQS

A library for building Xpath queries in an OOP style. In a JOOQ way, but for the XPATH.

Usage

Apache Maven

<dependency>
  <groupId>org.xpathqs</groupId>
  <artifactId>core</artifactId>
  <version>0.0.7</version>
</dependency>

Gradle Kotlin DSL

implementation("org.xpathqs:core:0.0.7")

Gradle Groovy DSL

implementation 'org.xpathqs:core:0.0.7'

Quick Example

Simple selector with tag and text:

tagSelector("div").text("demo").toXpath()

Will return such XPATH query:

//div[text()='test']

Selector with tag, text contains, and position:

tagSelector("div").text("test", contains = true)[2].toXpath()

Result:

//div[contains(text(), 'test') and position()=2]

For more examples you can discover unit tests.

Immutability

...

Coding conventions

  1. One line per func call

Unit Tests notation

Self Documentation

Each public method should:

  • contain java-doc
  • have a contract and requirements
  • have a link to the unit-tests associated with a concrete requirement

License

This XpathQS lib is released under the MIT License.