Module : lang.xml

Module Overview

This module provides lang library operations on xml values defined by the language specification 2020R1.

Objects

$anonType$7

Functions

concat

Concatenates xml and string values.

createComment

Constructs an xml sequence consisting of only a comment item.

createElement

Constructs an xml sequence consisting of only a new element item.

createProcessingInstruction

Constructs an xml sequence consisting of only a processing instruction item.

elements

Selects the elements from an xml value.

filter

Selects the items from an xml sequence for which a function returns true. Each item is represented as a singleton value.

forEach

Applies a function to each item in an xml sequence. Each item is represented as a singleton value.

fromString

Constructs an xml value from a string. This parses the string using the content production of the XML 1.0 Recommendation.

get

Returns the item of x with index i. This differs from x[i] in that it panics if x does not have an item with index i.

getAttributes

Returns the map representing the attributes of elem. This includes namespace attributes. The keys in the map are the expanded names of the attributes.

getChildren

Returns the children of elem.

getContent

Returns the content of a text or processing instruction or comment item.

getName

Returns a string giving the expanded name of elem.

getTarget

Returns the target part of the processing instruction.

iterator

Returns an iterator over the xml items of x

length

Returns number of xml items in x.

map

Applies a function to each item in an xml sequence, and returns an xml sequence of the results. Each item is represented as a singleton value.

setChildren

Sets the children of elem to children. This panics if it would result in the element structure becoming cyclic.

setName

Change the name of element elem to xName.

slice

Returns a subsequence of an xml value.

strip

Strips the insignificant parts of the an xml value. Comment items, processing instruction items are considered insignificant. After removal of comments and processing instructions, the text is grouped into the biggest possible chunks (i.e. only elements cause division into multiple chunks) and a chunk is considered insignificant if the entire chunk is whitespace.

Constants

XML_NAMESPACE_URI

The namespace URI bound to the xml prefix.

XMLNS_NAMESPACE_URI

The namespace URI bound to the xmlns prefix.

space

The expanded name of the xml:space attribute.

lang

The expanded name of the xml:lang attribute.

base

The expanded name of the xml:base attribute.