Pudu programming language
Menu
API reference

Std.Xml.decode

1 declaration

fn

decode: Str -> Result[Std.Xml.Tag, Std.Xml.XmlError]

This is a callable function.

What it does

What this reads.

Elements, attributes, text, CDATA, comments, the declaration, and the five

entities the format defines plus numeric character references. That is what

a SOAP envelope, a SAML assertion, an RSS feed, and a configuration file

are made of.

It reads rather than validates: no schema, no DTD, no entity declarations.

A DTD is refused rather than skipped, because a document that declares its

own entities means something this cannot work out, and the way that

normally goes wrong — a declaration that expands to gigabytes, or one that

reads a file off the machine — is not a failure worth having.

Read a document, answering its root element.

The runtime's xmlDecode reads the document first, natively. It answers

only documents it reads exactly as the reader below does and leaves every

other document, including every malformed one, to that reader, so a refusal

is described at the same position and in the same words either way.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.
  • Names inside [ ] are type arguments, such as the item type held by a collection.
  • Result makes success and recoverable failure part of the function's type.

Back to Std.XmlSearch related declarations