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.1.tar.gz (297.1 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.1-cp313-cp313-win_amd64.whl (354.6 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

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

File metadata

  • Download URL: htql-1.0.1.tar.gz
  • Upload date:
  • Size: 297.1 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.1.tar.gz
Algorithm Hash digest
SHA256 e84d8420d9ae205d1af87e18273e95ac321444e79082a6f018d699b3422d39f4
MD5 70f741570a075021f6db1fa67ff6856e
BLAKE2b-256 fc29c84102404f3e2d6c0d388db294fab09b17a36e160c5919fc8e78cad290e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: htql-1.0.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 354.6 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 509431a9f15908f34b081351c0fd83483c1e70e2bdaf22b1120f2599634507e1
MD5 8e384c832246fafce0d5034d693b3006
BLAKE2b-256 a268c415aa3d7b874ca942ab6de3622918fa93174f6d195ccad90dff74304e75

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