All Projects → Bystroushaak → DHTMLParser

Bystroushaak / DHTMLParser

Licence: other
D HTML Parser, similar to python BeautifulSoup

Programming Languages

d
599 projects
perl
6916 projects

Projects that are alternatives of or similar to DHTMLParser

Cppast
Library to parse and work with the C++ AST
Stars: ✭ 1,003 (+5800%)
Mutual labels:  parser-library
Libpypa
libpypa is a Python parser implemented in pure C++
Stars: ✭ 172 (+911.76%)
Mutual labels:  parser-library
autumn
A Java parser combinator library written with an unmatched feature set.
Stars: ✭ 112 (+558.82%)
Mutual labels:  parser-library
Mediawiki
MediaWiki API wrapper in python http://pymediawiki.readthedocs.io/en/latest/
Stars: ✭ 89 (+423.53%)
Mutual labels:  parser-library
Pygdbmi
A library to parse gdb mi output and interact with gdb subprocesses
Stars: ✭ 139 (+717.65%)
Mutual labels:  parser-library
Tatsu
竜 TatSu generates Python parsers from grammars in a variation of EBNF
Stars: ✭ 198 (+1064.71%)
Mutual labels:  parser-library
Recognizers Text
Microsoft.Recognizers.Text provides recognition and resolution of numbers, units, and date/time expressed in multiple languages (ZH, EN, FR, ES, PT, DE, IT, TR, HI. Partial support for NL, JA, KO, SV). Contributions are greatly welcome! Packages are available at https://www.nuget.org/profiles/Recognizers.Text and https://www.npmjs.com/~recognizers.text
Stars: ✭ 915 (+5282.35%)
Mutual labels:  parser-library
kiuatan
A parser library for Pony.
Stars: ✭ 15 (-11.76%)
Mutual labels:  parser-library
Uriparser
🔪 Strictly RFC 3986 compliant URI parsing and handling library written in C89; moved from SourceForge to GitHub
Stars: ✭ 163 (+858.82%)
Mutual labels:  parser-library
html-parser
A simple and general purpose html/xhtml parser, using Pest.
Stars: ✭ 56 (+229.41%)
Mutual labels:  html-parser
Cppcmb
A generic C++17 parser-combinator library with a natural grammar notation.
Stars: ✭ 108 (+535.29%)
Mutual labels:  parser-library
Chevrotain
Parser Building Toolkit for JavaScript
Stars: ✭ 1,795 (+10458.82%)
Mutual labels:  parser-library
Lark
Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
Stars: ✭ 2,916 (+17052.94%)
Mutual labels:  parser-library
Mibble
Mibble is an open-source SNMP MIB parser library for Java.
Stars: ✭ 84 (+394.12%)
Mutual labels:  parser-library
android-pls-parser
A playlist file (*.pls) parser library for Android
Stars: ✭ 19 (+11.76%)
Mutual labels:  parser-library
Substitution Schedule Parser
Java library for parsing schools' substitution schedules. Supports multiple different systems mainly used in the German-speaking countries, including Untis, svPlan, and DAVINCI
Stars: ✭ 33 (+94.12%)
Mutual labels:  parser-library
Participle
A parser library for Go
Stars: ✭ 2,302 (+13441.18%)
Mutual labels:  parser-library
bkit
build a messenger bot using HTML
Stars: ✭ 36 (+111.76%)
Mutual labels:  html-parser
html5parser
A super tiny and fast html5 AST parser.
Stars: ✭ 153 (+800%)
Mutual labels:  html-parser
Scpi Parser
Open Source SCPI device library
Stars: ✭ 227 (+1235.29%)
Mutual labels:  parser-library
DHTMLParser 

= What is it? =
	DHTMLParser is a lightweight parser created for one purpose - quick parsing 
	of selected information, when you know where to look.
	
	It can be very useful when you're writing your own API for a page, or a 
	checker (a script that is continuously checking something on the web and 
	alerts you when the information being checked has been changed).
	
	If you want, you can also create HTML/XML documents much more easily than 
	from a string.

= How it works? =
	The module has just one, important function - parseString(), which takes
	a string and returns a DOM (Document Object Model) made of HTMLElement 
	objects.
	
	The DOM is encapsulated in a container - a blank HTMLElement that holds
	the whole DOM in its .childs property.

= HTMLElement =
|
|++ HTMLElement[] childs
|		If the element has children, they are stored in this property.
|
|++ string[string] params
|		If the element has parametres, you will find them here.
|
|++ HTMLElement endtag
|		In case this tag is an Opener (<p> for example), this variable holds a 
|		link to the closing element (</p>).
|
|++ HTMLElement openertag
|		Analogous to endtag.
|
|-- HTMLElement[] find(string tag_name, string[string] params = null, function fn = null)
|		Same as findAll(), but doesn't returns endtags. You can always get them 
|		from .endtag property.
|
|-- HTMLElement[] findB(string tag_name, string[string] params = null, function fn = null)
|		Same as find(), but using Breadth-first search algorithm.
|
|-- HTMLElement[] findAll(string tag_name, string[string] params = null, function fn = null)
|		One of the most important methods, which handles DOM queries.
|
|		Lets say that you want each link in a page - 'dom.find("a")' will 
|		return an array of links.
|
|		You can also specify parametres or define a lambda function which will 
|		find whatever you want.
|
|		This method is using depth-first algorithm. For bread-first, see findAllB()
|		and findB().
|
|-- HTMLelement findAllB(string tag_name, string[string] params = null, function fn = null)
|		Same as findAll(), but using Breadth-first search algorithm.
|
|		See http://en.wikipedia.org/wiki/Breadth-first_search for details.
|
|-- bool isTag()
|		Returns true if the element is a tag (closed in <>). Comments aren't tags!
|
|-- bool isOpeningTag()
|		Returns true if element have .endtag (is closed).
|
|-- bool isEndTag()
|		Returns true if closing tag. 
|
|-- bool isEndTagTo(HTMLElement opener)
|		Returns true if this element is an end tag </tagname> for given element.
|
|-- bool isNonPairTag()
|		Returns true if nonpair tag (<br /> for example).
|
|-- void isNonPairTag(bool isnonpairtag)
|		Setter which allows setting whether this element is nonpair. 
|
|-- bool isComment()
|		Returns true if this element is an HTML comment (<!-- -->).
|
|-- bool isAlmostEqual(string tag_name, string[string] params = null, bool function(HTMLElement) fn = null)
|		Compare element with given tagname, params and/or by lambda function.
|
|		Lambda function is same as in .find().
|
|-- string toString()
|		String representation of this element, same as prettify().
|
|-- string prettify()
|		Returns prettified HTML output with childs (full document).
|
|-- void replaceWith(HTMLElement el)
|		Replace element.
|
|		Useful when you don't want change manually all references to object.
|
|-- void removeChild(HTMLElement child, bool end_tag_too = true)
|		Removes given subelement. Element is specified by reference, not by
|		value, so it always removes only one element!
|
|		end_tag_too specifies if endtag shoud be removed too. Default true.
|
|-- string tagToString()
|		Returns a string representation if tag, without childs.
|
|-- string getTagName()
|		Tagname - <a href="bla"> returns "a".
|
`-- string getContent()
		Childs to string.

= Creating DOM =
	If you want to create DOM from HTMLElements, you can use one of theese 
	constructors:

	HTMLElement()
		Blank element.
	
	HTMLElement("<tag>")
		From string containing tag (only one tag).
	
	HTMLElement("<tag>", ["param":"value"])
		Tag (with or without <>) with parameters defined by dictionary.
	
	These constructors are useful for creating documents:
	
		HTMLElement("tag", ["param":"value"], [new HTMLElement("<tag1>"), new HTMLElement("<tag2>"), ...])
			With specified tag, params and childs.
			
		HTMLElement("tag", [new HTMLElement("<tag1>"), new HTMLElement("<tag2>"), ...])
			With specified tag and childs.

		HTMLElement([new HTMLElement("<tag1>"), new HTMLElement("<tag2>"), ...])
			With speicifed childs. Usefull for containers.

= Confused? =
	If you don't understand how to use it, look at examples in ./examples/.
	
	If you still have questions, you can write me an email to: 
		[email protected]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].