/usr/local/lib/swipl/library/ext/sgml/sgml.pl
All Application Manual Name SummaryHelp

  • ext
    • sgml
      • sgml.pl -- SGML, XML and HTML parser
        • dtd/2
        • load_dtd/3
        • load_structure/3
        • load_sgml_file/2
        • load_xml_file/2
        • load_html_file/2
        • load_html/3
        • load_xml/3
        • load_sgml/3
        • xml_quote_attribute/2
        • xml_quote_cdata/2
        • xml_name/1
        • xml_basechar/1
        • xml_ideographic/1
        • xml_combining_char/1
        • xml_digit/1
        • xml_extender/1
        • xml_is_dom/1
      • xpath.pl -- Select nodes in an XML DOM
      • sgml_write.pl -- XML/SGML writer module
 load_structure(+Source, -ListOfContent, :Options) is det
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.