Skip to main content

Hyper-Text Query Language for querying HTML, XML and text documents

Project description

HTQL - the Hyper-Text Query Language

The Hyper-Text Query Language (HTQL) is a language for the querying and transformation of HTML, XML and plain text documents. HTQL is developed in C++ with fast and efficient data extraction algorithms. HTQL can be used to:

  • Extract data from HTML pages
  • Retrieve HTML page through HTTP protocol
  • Modify HTML pages

Python Installation

Run:

pip install htql

Python Examples

A simple example to extract url and text from links.

import htql

page="<a href=a.html>1</a><a href=b.html>2</a><a href=c.html>3</a>"
query="<a>:href,tx"

for url, text in htql.query(page, query):
    print(url, text)

Another example to parse state and zip from US address using HTQL regular expression:

import htql
address = '88-21 64th st , Rego Park , New York 11374'
states=['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut',
    'Delaware', 'District Of Columbia', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana',
    'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan',
    'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',
    'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma',
    'Oregon', 'PALAU', 'Pennsylvania', 'PUERTO RICO', 'Rhode Island', 'South Carolina', 'South Dakota',
    'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin',
    'Wyoming']

a=htql.RegEx()
a.setNameSet('states', states)

state_zip1=a.reSearchStr(address, r"&[s:states][,\s]+\d{5}", case=False)[0]
# state_zip1 = 'New York 11374'

state_zip2=a.reSearchList(address.split(), r"&[ws:states]<,>?<\d{5}>", case=False)[0]
# state_zip2 = ['New', 'York', '11374']

Manuals

Home

http://htql.net

Citation

  • Liangyou Chen. Ad Hoc Integration and Querying of Heterogeneous Online Distributed Databases. 2004. Ph.D. Dissertation, Department of Computer Science & Engineering, Mississippi State University.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

htql-1.0.3.tar.gz (300.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

htql-1.0.3-cp313-cp313-win_amd64.whl (355.2 kB view details)

Uploaded CPython 3.13Windows x86-64

htql-1.0.3-cp310-cp310-win_amd64.whl (422.5 kB view details)

Uploaded CPython 3.10Windows x86-64

File details

Details for the file htql-1.0.3.tar.gz.

File metadata

  • Download URL: htql-1.0.3.tar.gz
  • Upload date:
  • Size: 300.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for htql-1.0.3.tar.gz
Algorithm Hash digest
SHA256 9033dab0d6bed00d4a108611808fd37f254dec302c56624ce66327bce436d0d3
MD5 6952a31e6cfc52c6fd9b96b7c09264ec
BLAKE2b-256 90a400276fca3a778ab6eb8f17093323f70d1a187ce76b75a358c88a875dcbbd

See more details on using hashes here.

File details

Details for the file htql-1.0.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: htql-1.0.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 355.2 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for htql-1.0.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ed43f4bfba405ba0213f0f8e31efdc53baa165ee5f35dc23df42a2c0d6db8781
MD5 4a8305400c6e07b72711b1895c0ef2a2
BLAKE2b-256 1d7d03f161e96e80e2316e760117c0cdf7e77b717f6e5c8f808e9d72e1286284

See more details on using hashes here.

File details

Details for the file htql-1.0.3-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: htql-1.0.3-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 422.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for htql-1.0.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e6107e4040da13230c0de80f48c47a374cbc6752d973c91ce0e9c89b844cbd73
MD5 1574d6ffac225e4f2f73ada834ef3c6d
BLAKE2b-256 17cea2b09010b95129b0b76c566c1e0ce31c37d0fd586fd65f2a875361d93958

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page