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:

python setup.py install

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, "&[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.0.tar.gz (296.7 kB view details)

Uploaded Source

Built Distribution

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

htql-1.0.0-cp313-cp313-win_amd64.whl (354.5 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

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

File metadata

  • Download URL: htql-1.0.0.tar.gz
  • Upload date:
  • Size: 296.7 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.0.tar.gz
Algorithm Hash digest
SHA256 2dcf8d7a50a90db3d910089cd460d1876f17e33540bb9e59ee38c6d0fcc636bc
MD5 2503634cd1cb6621259c8205136f1cee
BLAKE2b-256 945e84080be63c2c71aed6e43799ab8f933ac8b9e5dbffc35af4557aecca655a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: htql-1.0.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 354.5 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.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b2181f11e227b78d07dbb81f3296a97bb347e58f7dcedd7080fec1bc505d4cf7
MD5 2326abb89f834d2302ad75aeb8a9eb1e
BLAKE2b-256 dc5c3510b885c276d382bc8c582add22c20e25b6e8812573a5bc76ecea4841de

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