43#define ZXSD_BIND_NO_OFFSET ((size_t)(-1))
243#define ZXSD_BIND_RUNTIME_CONFIG_INIT \
245 ZXSD_RUNTIME_CONFIG_INIT, ZXSD_BINDING_ABI_VERSION, \
247 sizeof(zxsd_bind_field_t), sizeof(zxsd_bind_type_t), \
248 sizeof(zxsd_bind_root_t), sizeof(zxsd_bind_arena_t), \
249 sizeof(zxsd_bind_stream_t), sizeof(zxsd_bind_stream_frame_t) \
400 size_t capacity,
size_t *length);
418 const void *
object,
char *buffer,
419 size_t capacity,
size_t *length,
zxsd_whitespace_t
Whitespace treatment prescribed by an XML Schema simple type.
#define ZXSD_MAX_DEPTH
Maximum nesting depth accepted by the embedded XML parser.
#define ZXSD_MAX_ATTRIBUTES
Maximum number of attributes in one element.
zxsd_bind_action_t
Next action after one locally validated, typed subtree has been delivered.
zxsd_result_t zxsd_bind_read_with_allocator(const zxsd_bind_root_t *root, const char *xml, void *object, zxsd_bind_arena_t *arena, const zxsd_allocator_t *allocator)
Read like zxsd_bind_read, validating with a scratch allocator.
zxsd_bind_kind_t
C representation of one bound value.
zxsd_result_t zxsd_bind_stream_init(zxsd_bind_stream_t *reader, const zxsd_bind_selection_t *selection, void *object, zxsd_bind_arena_t *arena, zxsd_bind_item_fn callback, void *user_data, const zxsd_allocator_t *allocator)
Initialize a single-pass selected-subtree binding reader.
const zxsd_schema_t *(* zxsd_bind_schema_fn)(void)
Access a generated schema descriptor.
void ZXSD_BINDING_ABI_GUARD(void)
Link-time binding ABI guard used by generated code; no side effects.
zxsd_bind_role_t
XML item carrying a bound value.
struct zxsd_bind_type zxsd_bind_type_t
Generated descriptor for a bound structure.
void zxsd_bind_arena_init(zxsd_bind_arena_t *arena, void *storage, size_t capacity)
Initialize a reading arena over caller-provided storage.
zxsd_result_t zxsd_bind_write_buffer(const zxsd_bind_root_t *root, const void *object, char *buffer, size_t capacity, size_t *length)
Serialize a bound structure into a buffer and validate the result.
void zxsd_bind_stream_dispose(zxsd_bind_stream_t *reader)
Release identity scratch, clear output, and restore the borrowed arena.
zxsd_bind_storage_t
Storage layout of a bound member inside its structure.
zxsd_bind_action_t(* zxsd_bind_item_fn)(void *user_data, const void *object)
Receive one complete, locally validated selected subtree.
zxsd_result_t zxsd_bind_stream_feed(zxsd_bind_stream_t *reader, const void *data, size_t length)
Consume arbitrary raw XML bytes without retaining the fragment.
int(* zxsd_bind_sink_fn)(void *context, const char *data, size_t length)
Output callback used by zxsd_bind_write.
zxsd_result_t zxsd_bind_stream_finish(zxsd_bind_stream_t *reader)
Finish parsing and validate document-wide constraints.
struct zxsd_bind_field zxsd_bind_field_t
Generated descriptor for one member of a bound structure.
zxsd_result_t zxsd_bind_write(const zxsd_bind_root_t *root, const void *object, zxsd_bind_sink_fn sink, void *context, zxsd_stream_t *validator)
Serialize a bound structure as an XML document.
zxsd_result_t zxsd_bind_read(const zxsd_bind_root_t *root, const char *xml, void *object, zxsd_bind_arena_t *arena)
Validate a document and fill a bound structure from it.
zxsd_result_t zxsd_bind_write_buffer_with_allocator(const zxsd_bind_root_t *root, const void *object, char *buffer, size_t capacity, size_t *length, const zxsd_allocator_t *allocator)
Write like zxsd_bind_write_buffer, validating with a scratch allocator.
zxsd_result_t zxsd_bind_check_runtime(const zxsd_bind_runtime_config_t *expected)
Check core configuration and binding layout sizes before using bindings.
@ ZXSD_BIND_CALLBACK_ERROR
Reject delivery with ZXSD_ERR_OUTPUT.
@ ZXSD_BIND_VALIDATE_ONLY
Stop materializing, but validate the remaining document.
@ ZXSD_BIND_CONTINUE
Materialize the next occurrence with the same arena.
@ ZXSD_BIND_INT64
int64_t, from xs:long.
@ ZXSD_BIND_UINT8
uint8_t, from xs:unsignedByte.
@ ZXSD_BIND_UINT32
uint32_t, from xs:unsignedInt.
@ ZXSD_BIND_STRING
const char * NUL-terminated UTF-8 text.
@ ZXSD_BIND_COMPLEX
Generated structure described by zxsd_bind_type_t.
@ ZXSD_BIND_UINT64
uint64_t, from xs:unsignedLong.
@ ZXSD_BIND_INT32
int32_t, from xs:int.
@ ZXSD_BIND_ENUM
Generated C enumeration indexing a value table.
@ ZXSD_BIND_INT8
int8_t, from xs:byte.
@ ZXSD_BIND_UINT16
uint16_t, from xs:unsignedShort.
@ ZXSD_BIND_INT16
int16_t, from xs:short.
@ ZXSD_BIND_ATTRIBUTE
Attribute of the enclosing element.
@ ZXSD_BIND_CONTENT
Character content of a simpleContent element.
@ ZXSD_BIND_ELEMENT
Child element.
@ ZXSD_BIND_POINTER
The member is a const pointer to one item; NULL means absent.
@ ZXSD_BIND_INLINE
The value is stored in the member itself.
@ ZXSD_BIND_ARRAY
The member is a const pointer to items with a size_t count member.
Optional allocator used by validation features requiring scratch storage.
Caller-owned bump allocator used when reading a document.
size_t used
Number of bytes already allocated.
unsigned char * data
First byte of the arena storage.
size_t capacity
Number of bytes in data.
Generated descriptor for one member of a bound structure.
const char * default_value
Schema default value, or NULL.
zxsd_whitespace_t whitespace
Normalization applied when reading.
const char * fixed_value
Schema fixed value, or NULL.
unsigned long min_occurs
Minimum occurrences, zero when optional.
size_t presence_offset
Offset of the bool presence member.
const char * name
XML local name.
size_t value_size
Size of one stored value or array item.
zxsd_bind_kind_t kind
C value representation.
size_t offset
Offset of the value, pointer or array member.
zxsd_bind_storage_t storage
Member layout.
size_t count_offset
Offset of the size_t count member.
size_t enumeration_count
Number of enumeration values.
const char * namespace_uri
XML namespace URI, or NULL.
zxsd_bind_role_t role
Attribute, child element or content.
const char *const * enumeration
Lexical values of an enumeration.
unsigned long max_occurs
Maximum occurrences, or ULONG_MAX.
const struct zxsd_bind_type * type
Nested structure for complex values.
Namespace prefix declared on the root element when writing.
const char * namespace_uri
Namespace URI bound to prefix.
const char * prefix
Generated prefix.
One generation-time-resolved element step; prefixes are not identities.
const char * namespace_uri
Namespace URI, or NULL.
const char * name
Element local name.
Generated descriptor for a bound global element.
const char * fixed_value
Root fixed content, or NULL.
const char * namespace_uri
Root namespace URI, or NULL.
const zxsd_bind_type_t * type
Root structure descriptor.
size_t namespace_count
Number of entries in namespaces.
const char * name
Root local name.
zxsd_bind_schema_fn schema
Generated validation descriptor accessor.
const char * default_value
Root default content, or NULL.
const zxsd_bind_namespace_t * namespaces
Prefixes declared on the root.
Binding-specific layout stamp; initialize with ZXSD_BIND_RUNTIME_CONFIG_INIT.
zxsd_runtime_config_t runtime
Core epochs, limits, and layouts.
unsigned int binding_abi
Typed binding epoch.
Immutable selection emitted by zxsdc --stream-bind.
const char * fixed_value
Selected element fixed value, or NULL.
size_t step_count
Number of path steps.
const char * default_value
Selected element default, or NULL.
const zxsd_bind_type_t * type
Selected structure; simple selections have a value member.
const zxsd_bind_path_step_t * steps
Absolute element path, including the root.
zxsd_bind_schema_fn schema
Full document schema, including unselected content.
Internal binding frame, exposed only for static allocation.
unsigned char path_match
Absolute selection prefix matches through this depth.
void * object
Caller/arena storage receiving this element.
const zxsd_bind_field_t * field
Scalar element descriptor, if any.
const zxsd_bind_type_t * type
Complex or simpleContent structure, if any.
Single-pass validating typed reader with caller-owned, reusable storage.
size_t arena_mark
Arena usage restored after delivery/error/dispose.
void * object
Caller-owned selected structure.
const zxsd_bind_selection_t * selection
Generated selection.
void * user_data
Application context.
zxsd_bind_arena_t * arena
Arena borrowed until dispose.
size_t active_depth
Selected element depth, or zero.
int finished
Whether finish completed successfully.
int validate_only
Whether further materialization is disabled.
zxsd_bind_item_fn callback
Typed delivery adapter.
zxsd_xml_reader_t xml
Raw parser and full-document validator.
Generated descriptor for a bound structure.
const zxsd_bind_field_t * fields
Attributes, then elements, then content.
size_t field_count
Number of entries in fields.
const char * type_namespace
Named XSD type namespace, or NULL.
const char * type_name
Named XSD type, or NULL if anonymous.
const char * name
Generated C type name, for diagnostics.
size_t size
Size of the structure.
Structured result returned by every generated validator.
Caller configuration stamp for a same-toolchain runtime boundary.
Root descriptor consumed by the generic validation runtime.
Bounded state for the event-driven validator.
Bounded raw-XML reader feeding an event-driven validator.
Public API for the zxsd XML validation runtime.