@xml_read(file:string)
parse an XML file into an Antescofo value. The argument of the function is the path of the file. Note that an XML text can be written directly in an Antescofo program after the keyword XML:: and is implicitly converted into an Antescofo value.

The encoding of an XML file into an Antescofo value is as follow :

  • A valid XML text is described as a sequence of tags and is translated into a vector.

  • Meta-data tags (e.g. <?xml? ... ?> and comments are ignored in the translation.

  • Each remaining tag is translated into a triple (a vector of 3 elements) [name, map, content]:

  • The first element name is a string giving the name of the tag.
  • The second element map is a map describing the attributes of the tag. The map is empty if there is no attribute.
  • If the tag specified by the 3-uple has a content, this content is a sequence interleaving text and tags. The third elements is a vector representing this succession of elements.

For instance,

$m := XML:: <a>
              <b>1</b>
              <c>3.14159</c>
            </a>
will build the following Antescofo value:
$m := [ "a",
        MAP{},
        [ ["b", MAP{}, [1]],
          ["c", MAP{}, [3.14159]]
        ]
      ]
A tag with content and attributes
$m := XML::<title size="big" font="times">Hello <strong>World</strong> ! </>
is equivalent to
$m := [ "title",
        MAP{ ("font", "times"), ("size", "big") },
        ["Hello ", ["strong", MAP{}, ["World"]], " ! "]
      ]

See also @xml_string.

Data Exchange Functions: @dump    @dumpvar    @gnuplot    @json_read    @json_string    @json_write    @loadvalue    @loadvar    @nim2vezer    @parse    @plot    @read_file    @rplot    @savevalue    @set_osc_handling_double    @set_osc_handling_int64    @set_osc_handling_tab    @string2fun    @string2obj    @string2proc    @to_num    @xml_read    @xml_string