38typedef enum : uint16_t {
62typedef enum : uint8_t {
125 const uint8_t* source,
206 bool* out_has_value);
240 const char* literal);
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Mutable cursor for one start event's attributes.
uint16_t emitted
Attributes already returned.
uint32_t position
Next scan position.
Source-order attribute view.
xml_span_t value
Quoted value excluding delimiters.
xml_span_t name
Attribute name.
uint16_t attribute_count
Source-order attributes on start.
xml_span_t markup
Complete markup span, or text payload.
uint8_t self_closing
One for an empty-element start.
xml_span_t name
Element name for start/end.
uint16_t depth
Root is depth zero.
uint8_t kind
xml_event_kind_t.
One open-element identity retained for close-tag validation.
uint16_t consumer
Consumer-owned while this frame is live.
uint16_t name_length
Element-name byte count.
uint32_t name_offset
Element-name offset in the source.
Pull-reader state; initialise before each pass.
uint8_t finished
End validation complete.
uint8_t root_count
Completed/started roots.
uint16_t stack_size
Open element count.
const uint8_t * source
Immutable source bytes.
uint8_t doctype_seen
One after a supported DOCTYPE.
xml_workspace_t * workspace
Caller-owned stack.
size_t source_len
Source byte count.
size_t position
Next scan position.
uint8_t declaration_seen
One after XML declaration.
uint8_t root_closed
One after root close.
Immutable byte span expressed relative to the source.
uint32_t length
Byte count.
uint32_t offset
First byte offset.
Exactly bounded caller-owned nesting storage.
xml_frame_t frames[k_xml_workspace_frames]
Open-element stack.
xml_limits_t
Fixed parser geometry.
@ k_xml_max_element_depth
Accepted element levels, including root.
@ k_xml_workspace_frames
Physical frame capacity with headroom.
ra8_err_t xml_decoded_size(const uint8_t *source, size_t source_len, xml_span_t span, size_t *out_length)
Measure the entity-decoded byte count of a bounded span.
bool xml_decoded_equal(const uint8_t *source, size_t source_len, xml_span_t left, xml_span_t right)
Compare two entity-decoded spans from the same immutable source.
void xml_attr_begin(const xml_event_t *event, xml_attr_cursor_t *cursor)
Initialise source-order attribute iteration for a start event.
bool xml_span_local_equal(const uint8_t *source, size_t source_len, xml_span_t span, const char *literal)
Compare the namespace-local tail of a bounded span with an ASCII literal.
ra8_err_t xml_attr_next(const uint8_t *source, size_t source_len, const xml_event_t *event, xml_attr_cursor_t *cursor, xml_attribute_t *out_attribute, bool *out_has_value)
Return the next source-order attribute.
xml_event_kind_t
Pull-event kind.
@ k_xml_event_cdata
CDATA payload.
@ k_xml_event_start
Element start.
@ k_xml_event_none
No event / end of source.
@ k_xml_event_text
Character-data run.
@ k_xml_event_end
Element end.
ra8_err_t xml_validate(const uint8_t *source, size_t source_len, xml_workspace_t *workspace)
Validate a complete document before any consumer mutation.
bool xml_span_equal(const uint8_t *source, size_t source_len, xml_span_t span, const char *literal)
Compare a bounded span with an exact ASCII literal.
ra8_err_t xml_decode(const uint8_t *source, size_t source_len, xml_span_t span, char *destination, size_t capacity, size_t *out_length)
Entity-decode a source span into a bounded NUL-terminated buffer.
ra8_err_t xml_reader_init(xml_reader_t *reader, const uint8_t *source, size_t source_len, xml_workspace_t *workspace)
Initialise a pull pass over immutable bytes.
ra8_err_t xml_reader_next(xml_reader_t *reader, xml_event_t *out_event)
Return the next semantic event and validate syntax incrementally.
ra8_err_t xml_decode_prefix(const uint8_t *source, size_t source_len, xml_span_t span, char *destination, size_t capacity, size_t *out_length)
Decode the longest complete prefix that fits the destination.