Expand description
XML structures XML and XHTML parsing for declarative UI definitions.
This module provides comprehensive XML parsing and manipulation for Azul’s XML-based
UI format (.azul files). It supports:
- XHTML parsing: Parse HTML-like syntax into DOM structures
- CSS extraction: Extract
<style>blocks and inline styles - Component system: Define reusable UI components with arguments
- Hot reload: Track file changes and rebuild UI incrementally
- Error reporting: Detailed syntax error messages with line/column info
§Examples
ⓘ
use azul_core::xml::{XmlNode, XmlParseOptions};
let xml = "<div>Hello</div>";
// let node = XmlNode::parse(xml)?;Structs§
- ARenderer
- Article
Renderer - Aside
Renderer - BRenderer
- Blockquote
Renderer - Body
Renderer - Render for a
bodycomponent - BrRenderer
- Render for a
brcomponent - Button
Renderer - Code
Renderer - Component
Arguments - A component can take various arguments (to pass down to its children), which are then later compiled into Rust function arguments - for example
- CssMatcher
- DdRenderer
- DivRenderer
- Render for a
divcomponent - DlRenderer
- DomXml
- Wrapper for the XML parser - necessary to easily create a Dom from
XML without putting an XML solver into
azul-core. - DtRenderer
- Duplicated
Attribute Error - Duplicated
Namespace Error - Dynamic
XmlComponent - Component that was created from a XML node (instead of being registered from Rust code). Necessary to
- EmRenderer
- External
Resource - An external resource URL found in an XML/HTML document
- External
Resource Vec - External
Resource VecSlice - C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
- Filtered
Component Arguments - Footer
Renderer - Form
Renderer - H1Renderer
- H2Renderer
- H3Renderer
- H4Renderer
- H5Renderer
- H6Renderer
- Head
Renderer - Header
Renderer - HrRenderer
- Html
Renderer - IRenderer
- Icon
Renderer - Renderer for an
iconcomponent - Invalid
Char Error - Invalid
Char Multiple Error - Invalid
Quote Error - Invalid
Space Error - Invalid
String Error - Label
Renderer - LiRenderer
- Main
Renderer - Malformed
Hierarchy Error - Error for mismatched open/close tags in XML hierarchy
- Mark
Renderer - Mime
Type Hint - MIME type hint for an external resource
- NavRenderer
- NonXml
Char Error - OlRenderer
- PreRenderer
- Section
Renderer - Small
Renderer - Span
Renderer - Strong
Renderer - SubRenderer
- SupRenderer
- Table
Renderer - Tbody
Renderer - TdRenderer
- Text
Renderer - Render for a
pcomponent - Tfoot
Renderer - ThRenderer
- Thead
Renderer - Title
Renderer - TrRenderer
- URenderer
- UlRenderer
- Unexpected
Close TagError - Unknown
Entity Reference Error - Unknown
Namespace Error - Xml
- XmlAttribute
Map - Attributes of an XML node, such as
["color" => "blue"]in<button color="blue" />. - XmlComponent
- XmlComponent
Map - Holds all XML components - builtin components
- XmlNode
- Represents one XML node tag
- XmlNode
Child Vec - XmlNode
Child VecSlice - C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
- XmlNode
Vec - XmlNode
VecSlice - C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
- XmlQualified
Name - XmlTag
Name - Tag of an XML node, such as the “button” in
<button>Hello</button>. - XmlText
Error - XmlText
Pos
Enums§
- Compile
Error - Error that can happen from the translation from XML code to Rust code - stringified, since it is only used for printing and is not exposed in the public API
- Component
Error - Component
Parse Error - DomXml
Parse Error - Dynamic
Item - Item of a split string - either a variable name or a string
- External
Resource Kind - Classification of an external resource referenced in HTML/XML
- External
Resource VecDestructor - Option
External Resource - Option
Mime Type Hint - Option
XmlNode - Option
XmlNode Child - Render
DomError - Result
XmlXml Error - XmlError
- XmlNode
Child - Represents a child of an XML node - either an element or text
- XmlNode
Child VecDestructor - XmlNode
Type - XmlNode
VecDestructor - XmlParse
Error - XmlStream
Error - c_void
Constants§
Traits§
- XmlComponent
Trait - Specifies a component that reacts to a parsed XML node
Functions§
- combine_
and_ replace_ dynamic_ items - Combines the split string back into its original form while replacing the variables with their values
- compile_
body_ node_ to_ rust_ code - compile_
component - compile_
components - compile_
components_ to_ rust_ code - Takes all components and generates the source code function from them
- compile_
node_ to_ rust_ code_ inner - find_
attribute - find_
node_ by_ type - Searches in the the
root_nodesfor anode_type, convenience function in order to for example find the firstnode in all these nodes. This function searches recursively through the entire tree. - format_
args_ dynamic - Given a string and a key => value mapping, replaces parts of the string with the value, i.e.:
- format_
component_ args - get_
body_ node - Find the one and only
<body>node, return error if there is no app node or there are multiple app nodes - get_
html_ node - Find the one and only
<body>node, return error if there is no app node or there are multiple app nodes - get_
item - Given a root node, traverses along the hierarchy, and returns a mutable reference to the last child node of the root node
- normalize_
casing - Normalizes input such as
abcDef,AbcDef,abc-defto the normalized form ofabc_def - parse_
bool - Parses a string (“true” or “false”)
- parse_
component_ arguments - Compiles a XML
args="a: String, b: bool"into a["a" => "String", "b" => "bool"]map - prepare_
string - render_
component_ inner - render_
dom_ from_ body_ node - render_
dom_ from_ body_ node_ inner - Takes a single (expanded) app node and renders the DOM or returns an error
- set_
attributes - set_
stringified_ attributes - split_
dynamic_ string - Splits a string into formatting arguments
- str_
to_ dom - Parses an XML string and returns a
StyledDomwith the components instantiated in the<app></app> - str_
to_ rust_ code - Parses an XML string and returns a
String, which contains the Rust source code (i.e. it compiles the XML to valid Rust) - validate_
and_ filter_ component_ args - Filters the XML attributes of a component given XmlAttributeMap
Type Aliases§
- Compiled
Component - Component
Argument Name - Component
Argument Order - Component
Argument Type - Component
Argument Types - Component
Name - External
Resource VecDestructor Type - Syntax
Error - Error that can occur during XML parsing or hot-reload.
- XmlNode
Child VecDestructor Type - XmlNode
VecDestructor Type - XmlText
Content - (Unparsed) text content of an XML node, such as the “Hello” in
<button>Hello</button>.