libdom
Loading...
Searching...
No Matches
character_valid.c File Reference
#include "utils/character_valid.h"
#include <assert.h>

Functions

bool _dom_is_character_in_group (unsigned int ch, const struct xml_char_group *group)
 

Variables

const struct xml_char_group base_char_group
 
const struct xml_char_group char_group
 
const struct xml_char_group combining_char_group
 
const struct xml_char_group digit_char_group
 
const struct xml_char_group extender_group
 
const struct xml_char_group ideographic_group
 

Function Documentation

◆ _dom_is_character_in_group()

bool _dom_is_character_in_group ( unsigned int ch,
const struct xml_char_group * group )

Test whether certain character beint32_ts to some XML character group

Parameters
chThe character being tested
groupThe character group
Returns
true if the character beint32_ts to the group, false otherwise.

Generally, we use an algorithm like binary search to find the desired character in the group. The time complexity is about lg(n) and here n is at most 180, so, I think the algorithm is fast enough for name validation.

Variable Documentation

◆ base_char_group

const struct xml_char_group base_char_group
Initial value:
= {
sizeof(base_char_range) / sizeof(base_char_range[0]),
base_char_range}

◆ char_group

const struct xml_char_group char_group
Initial value:
= {
sizeof(char_range) / sizeof(char_range[0]), char_range}

◆ combining_char_group

const struct xml_char_group combining_char_group
Initial value:
= {
sizeof(combining_char_range) / sizeof(combining_char_range[0]),
combining_char_range }

◆ digit_char_group

const struct xml_char_group digit_char_group
Initial value:
= {
sizeof(digit_char_range) / sizeof(digit_char_range[0]),
digit_char_range }

◆ extender_group

const struct xml_char_group extender_group
Initial value:
= {
sizeof(extender_range) / sizeof(extender_range[0]),
extender_range }

◆ ideographic_group

const struct xml_char_group ideographic_group
Initial value:
= {
sizeof(ideographic_range) / sizeof(ideographic_range[0]),
ideographic_range }