module
Saml::XMLUtil
Overview
XML helpers shared by every SAML message.
Defined in:
saml/xml_util.crConstant Summary
-
PARSER_OPTIONS =
XML::ParserOptions::NONET -
No RECOVER: libxml2 must refuse anything that isn't well-formed rather than repair it.
Class Method Summary
-
.add_child(parent : XML::Node, node : XML::Node) : XML::Node
Moves node (already in the same document) to the end of parent.
-
.add_element(parent : XML::Node, name : String, attributes = nil) : XML::Node
Adds an element under parent in the same document.
-
.add_next_sibling(sibling : XML::Node, node : XML::Node) : XML::Node
Moves node (already in the same document) right after sibling.
-
.add_prev_sibling(sibling : XML::Node, node : XML::Node) : XML::Node
Moves node (already in the same document) right before sibling.
-
.element_children(node : XML::Node) : Array(XML::Node)
Element children only, in document order.
-
.element_text(element : XML::Node | Nil) : String | Nil
Concatenates the element's own text and CDATA children only, so comments and child elements can't change or truncate the value.
- .escape_attribute(value : String) : String
-
.only_node(node, path : String, namespaces = nil, variables = nil) : XML::Node | Nil
Exactly one match or nil.
-
.safe_parse(xml : String) : XML::Node
Parses untrusted XML: well-formed only, no DOCTYPE, no network, and no errors or warnings at all (namespace errors don't stop libxml2 by themselves).
- .set_attribute(node : XML::Node, name : String, value : String) : Nil
Class Method Detail
Moves node (already in the same document) to the end of parent.
Adds an element under parent in the same document. Names and attributes may be prefixed; "xmlns"/"xmlns:p" entries declare namespaces.
Moves node (already in the same document) right after sibling.
Moves node (already in the same document) right before sibling.
Element children only, in document order.
Concatenates the element's own text and CDATA children only, so comments and child elements can't change or truncate the value.
Exactly one match or nil.
Parses untrusted XML: well-formed only, no DOCTYPE, no network, and no errors or warnings at all (namespace errors don't stop libxml2 by themselves).