module

Mica::XML

Generated by scripts/generate_composing_characters.cr from the Unicode 17.0.0 data in the Crystal standard library. Do not edit.

Class methods

build(version : String | Nil = nil, encoding : String | Nil = nil, indent = nil, quote_char : Char | Nil = nil, &) : String

Builds an XML document and returns it as a string. See Mica::XML::Builder.

Source
build(io : IO, version : String | Nil = nil, encoding : String | Nil = nil, indent = nil, quote_char : Char | Nil = nil, &) : Nil

Builds an XML document into io.

Source
build_fragment(io : IO, *, indent = nil, quote_char : Char | Nil = nil, &) : Nil

Builds an XML fragment into io.

Source
build_fragment(*, indent = nil, quote_char : Char | Nil = nil, &) : String

Builds an XML fragment (no declaration) and returns it as a string.

Source
parse(source : String | Bytes | IO, options : ParserOptions = ParserOptions.default, meter : Core::WorkMeter | Nil = nil) : Document

Parses source (a String, Bytes or IO) into a Mica::XML::Document.

document = Mica::XML.parse(%(<list><item id="1">one</item></list>))
document.root.try(&.first_element_child.try(&.["id"])) # => "1"

Raises Mica::ParseError (with line, column and byte offset) when the input is not well-formed, Mica::LimitExceededError when a safety limit, the work budget or the deadline trips, and Mica::EncodingError for an unsupported or invalid encoding. meter lets the parse share a work budget with other operations (for example the queries that follow it); without it the parse starts a meter from options.work_budget.

Source

Nested types