
sgml.pl -- SGML, XML and HTML parserThis library allows you to parse SGML, XML and HTML data into a Prolog data structure. The library defines several families of predicates:
The DOM structure can be used by library(xpath) to extract information from the document.
dtd(+Type, -DTD) is detdtd(Type). Loaded DTD
objects are cached. Note that DTD objects may not be shared
between threads. Therefore, dtd/2 maintains the pool of DTD
objects using a thread_local predicate. DTD objects are
destroyed if a thread terminates.
load_dtd(+DTD, +DtdFile, +Options)
load_structure(+Source, -ListOfContent, :Options) is detA proper XML document contains only a single toplevel element whose name matches the document type. Nevertheless, a list is returned for consistency with the representation of element content.
The encoding(+Encoding) option is treated special for
compatibility reasons:
iso-8859-1, us-ascii or utf-8,
the stream is opened in binary mode and the option is passed
to the SGML parser.
load_sgml_file(+File, -DOM) is det
load_xml_file(+File, -DOM) is det
load_html_file(+File, -DOM) is det
load_html(+Input, -DOM, +Options) is detdtd(html, DTD).html_dialectYou may also want to use the library(http/http_open) to support loading from HTTP and HTTPS URLs. For example:
:- use_module(library(http/http_open)).
:- use_module(library(sgml)).
load_html_url(URL, DOM) :-
load_html(URL, DOM, []).
load_xml(+Input, -DOM, +Options) is detdialect(xml)
load_sgml(+Input, -DOM, +Options) is detdialect(sgml)
xml_quote_attribute(+In, -Quoted) is det
xml_quote_cdata(+In, -Quoted) is det
xml_name(+Atom) is semidet
xml_basechar(+CodeOrChar) is semidet
xml_ideographic(+CodeOrChar) is semidet
xml_combining_char(+CodeOrChar) is semidet
xml_digit(+CodeOrChar) is semidet
xml_extender(+CodeOrChar) is semidet
xml_is_dom(@Term) is semidetThe following predicates are exported, but not or incorrectly documented.
sgml_register_catalog_file(Arg1, Arg2)
free_sgml_parser(Arg1)
new_dtd(Arg1, Arg2)
load_dtd(Arg1, Arg2)
xsd_time_string(Arg1, Arg2, Arg3)
xml_quote_attribute(Arg1, Arg2, Arg3)
set_sgml_parser(Arg1, Arg2)
free_dtd(Arg1)
xml_quote_cdata(Arg1, Arg2, Arg3)
get_sgml_parser(Arg1, Arg2)
open_dtd(Arg1, Arg2, Arg3)
iri_xml_namespace(Arg1, Arg2)
xml_name(Arg1, Arg2)
sgml_parse(Arg1, Arg2)
new_sgml_parser(Arg1, Arg2)
dtd_property(Arg1, Arg2)
iri_xml_namespace(Arg1, Arg2, Arg3)
xsd_number_string(Arg1, Arg2)