q

Simple package for query HTML/XML elements using a CSS3 or jQuery-like selector syntax


Keywords
css, selector, query, match, find, html, xml, jquery
License
MIT
Install
nimble install q

Documentation

q.nim

Simple package for query HTML/XML elements using a CSS3 or jQuery-like selector syntax for Nim.

This project is in alpha stage, some features are not supported yet.

Selectors

Installation

$ nimble install q

Changes

0.0.2 - supports sibling combinators and multiple class, attributes selectors
0.0.1 - initial release

Usage

import q
import xmltree

var html = """<html>
<head>
  <tile>Example</title>
</head>
<body>
  <nav>
    <ul class="menu">
      <li class="dropdown">
        <a href="#">Link 1</a>
      </li>
      <li>
        <a href="#">Link 2</a>
      </li>
    </ul>
  </nav
</body>
</html>"""


# Parse HTML document
var doc = q(html)

# Search for nodes by css selector
echo doc.select("nav ul.menu li a")
# @[<a href="#">Link 1</a>, <a href="#">Link 2</a>]