Functions -
lang.xml
children |
Returns the children of elements in an xml value.
|
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.
|
elementChildren |
Selects element children of an xml value
|
elements |
Selects elements from an xml value.
|
filter |
Selects the items from an xml sequence for which a function returns true.
|
forEach |
Applies a function to each item in an xml sequence.
|
fromString |
Constructs an xml value from a string.
|
get |
Returns the item of
x with index i .
|
getAttributes |
Returns the map representing the attributes of
elem .
|
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.
|
setChildren |
Sets the children of
elem to children .
|
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.
|
x
is of type Element, it is equivalent to getChildren
.
Parameters
- x xml
-
xml value
-
Return Type
(xml) xml sequence containing the children of each element x concatenated in order This is equivalent to
elements(x).map(getChildren)
.
Parameters
- xs xml | string[]
-
xml or string items to concatenate
-
Return Type
(xml) an xml sequence that is the concatenation of all the
xs
; an empty xml sequence if thexs
are empty
Parameters
- content string
-
the content of the comment to be constructed.
-
Return Type
(Comment) an xml sequence consisting of a comment with content
content
Parameters
- name string
-
the name of the new element
- children xml (default concat())
-
the children of the new element
-
Return Type
(Element) an xml sequence consisting of only a new xml element with name
name
, no attributes, and childrenchildren
Parameters
- target string
-
the target part of the processing instruction to be constructed
- content string
-
the content part of the processing instruction to be constructed
-
Return Type
(ProcessingInstruction) an xml sequence consisting of a processing instruction with target
target
and contentcontent
Parameters
- x xml
-
the xml value
- nm string? (default <string?> ())
-
the expanded name of the elements to be selected, or
()
for all elements
-
Return Type
(xml) an xml sequence consisting of child elements of elements in
x
; ifnm
is()
, returns a sequence of all such elements; otherwise, include only elements whose expanded name isnm
This is equivalent tochildren(x).elements(nm)
.
nm
is ()
, selects all elements;
otherwise, selects only elements whose expanded name is nm
.
Parameters
- x xml
-
the xml value
- nm string? (default <string?> ())
-
the expanded name of the elements to be selected, or
()
for all elements
-
Return Type
(xml) an xml sequence consisting of all the element items in
x
whose expanded name isnm
, or, ifnm
is()
, all element items inx
Parameters
- x xml
-
xml value
-
func
function(ItemType) returns (boolean)
-
a predicate to apply to each item to test whether it should be selected
-
Return Type
(xml) new xml sequence containing items in
x
for whichfunc
evaluates to true
Parameters
- x xml
-
the xml value
-
func
function(ItemType) returns (())
-
a function to apply to each item in
x
content
production of the
XML 1.0 Recommendation.
Parameters
- s string
-
a string in XML format
-
Return Type
(xml | error) xml value resulting from parsing
s
, or an error
x
with index i
.
This differs from x[i]
in that it panics if
x
does not have an item with index i
.
Parameters
- x xml
-
the xml sequence
- i int
-
the index
-
Return Type
(xml) the item with index
i
inx
elem
.
This includes namespace attributes.
The keys in the map are the expanded names of the attributes.
Parameters
- x Element
-
xml element
-
Return Type
(map) attributes of
x
elem
.
Parameters
- elem Element
-
xml element
-
Return Type
(xml) children of
elem
Parameters
- x Text | ProcessingInstruction | Comment
-
xml item
-
Return Type
(string) the content of
x
elem
.
Parameters
- elem Element
-
xml element
-
Return Type
(string) element name
Parameters
- x ProcessingInstruction
-
xml processing instruction item
-
Return Type
(string) target part of
x
x
Parameters
- x xml
-
xml sequence to iterate over
-
Return Type
(T7) iterator object Each item is represented by an xml singleton.
x
.
Parameters
- x xml
-
xml item
-
Return Type
(int) number of XML items in
x
Parameters
- x xml
-
the xml value
-
func
function(ItemType) returns (XmlType)
-
a function to apply to each child or
item
-
Return Type
(xml) new xml value containing result of applying
func
to each child oritem
elem
to children
.
This panics if it would result in the element structure
becoming cyclic.
Parameters
- elem Element
-
xml element
- children xml | string
-
xml or string to set as children
elem
to xName
.
Parameters
- elem Element
-
xml element
- xName string
-
new expanded name
Parameters
- x xml
-
the xml value
- startIndex int
-
start index, inclusive
- endIndex int (default <int> x.length(x))
-
end index, exclusive
-
Return Type
(xml) a subsequence of
x
consisting of items with index >= startIndex and < endIndex
Parameters
- x xml
-
the xml value
-
Return Type
(xml) x
with insignificant parts removed