Simple C Expat Wrapper (SCEW)  1.1.7
Typedefs | Functions
Comparison

Element comparison routines. More...

Typedefs

typedef scew_bool(* scew_element_cmp_hook )(scew_element const *, scew_element const *)
 SCEW element compare hooks might be used to define new user XML element comparisons. More...
 

Functions

SCEW_API scew_bool scew_element_compare (scew_element const *a, scew_element const *b, scew_element_cmp_hook hook)
 Performs a deep comparison of the two given elements. More...
 

Detailed Description

Element comparison routines.

Typedef Documentation

typedef scew_bool(* scew_element_cmp_hook)(scew_element const *, scew_element const *)

SCEW element compare hooks might be used to define new user XML element comparisons.

This hook must only compare the element's name and contents and the list of attributes. The new hook is to be used by scew_element_compare.

Returns
true if the given elements are considered equal, false otherwise.

Function Documentation

SCEW_API scew_bool scew_element_compare ( scew_element const *  a,
scew_element const *  b,
scew_element_cmp_hook  hook 
)

Performs a deep comparison of the two given elements.

The comparison is done via the comparison hook. If hook is NULL, the default comparison is done:

  • Name and contents are equal (case-sensitive).
  • Number of attributes match.
  • Attribute names and values match (case-sensitive).

It is important to note that, for any given hook (or if NULL), the children are automatically traversed recursively using the given hook. Therefore, the hook must only provide comparisons for element's name and contents and the list of attribtues.

There is no restriction on the provided comparison hook (if any), thus the user is responsible to define how the comparison is to be done.

Precondition
a != NULL
b != NULL
Parameters
aone of the elements to compare.
bone of the elements to compare.
hookthe user defined comparison function. If NULL, the default comparison is used.
Returns
true if both elements are considered equal, false otherwise.