Parse Source and return the resulting structure in
ListOfContent. Source is handed to open_any/5, which allows for
processing an extensible set of input sources.
A 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:
- If Encoding is one of
iso-8859-1
, us-ascii
or utf-8
,
the stream is opened in binary mode and the option is passed
to the SGML parser.
- If Encoding is present, but not one of the above, the
stream is opened in text mode using the given encoding.
- Otherwise (no Encoding), the stream is opened in binary
mode and doing the correct decoding is left to the parser.