When libxml2 support is available, the following functions can be used
to parse HTML or XML text into Lisp object trees.
-@defun libxml-parse-html-region start end &optional base-url discard-comments
+@defun libxml-parse-html-region &optional start end base-url discard-comments
This function parses the text between @var{start} and @var{end} as
HTML, and returns a list representing the HTML @dfn{parse tree}. It
attempts to handle real-world HTML by robustly coping with syntax
mistakes.
+If @var{start} or @var{end} are @code{nil}, they default to the values
+from @code{point-min} and @code{point-max}, respectively.
+
The optional argument @var{base-url}, if non-@code{nil}, should be a
string specifying the base URL for relative URLs occurring in links.
@end defun
@cindex parsing xml
-@defun libxml-parse-xml-region start end &optional base-url discard-comments
+@defun libxml-parse-xml-region &optional start end base-url discard-comments
This function is the same as @code{libxml-parse-html-region}, except
that it parses the text as XML rather than HTML (so it is stricter
about syntax).
xmlCheckVersion (LIBXML_VERSION);
+ if (NILP (start))
+ start = Fpoint_min ();
+
+ if (NILP (end))
+ end = Fpoint_max ();
+
validate_region (&start, &end);
istart = XFIXNUM (start);
DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
Slibxml_parse_html_region,
- 2, 4, 0,
+ 0, 4, 0,
doc: /* Parse the region as an HTML document and return the parse tree.
+If START is nil, it defaults to `point-min'. If END is nil, it
+defaults to `point-max'.
+
If BASE-URL is non-nil, it is used to expand relative URLs.
If you want comments to be stripped, use the `xml-remove-comments'
DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region,
Slibxml_parse_xml_region,
- 2, 4, 0,
+ 0, 4, 0,
doc: /* Parse the region as an XML document and return the parse tree.
+If START is nil, it defaults to `point-min'. If END is nil, it
+defaults to `point-max'.
+
If BASE-URL is non-nil, it is used to expand relative URLs.
If you want comments to be stripped, use the `xml-remove-comments'