README: Add note about ScanElement

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2023-04-19 14:08:56 +02:00
parent c05dda0c08
commit e39be87498
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -49,11 +49,27 @@ This library supports parsing the following:
Optional lines starting with a `#` or `//` and ending with a newline
(`\n`). They get discarded in the output
## minidom::Element
## ScanElement
Minidom `Element`s require every element to be namespaced. This parser adds
`jabber:client` as a default namespace. It also adds a `scansion` namespace
that is used for the `scansion:strict` XML parameter.
`ScanElement` is a wrapper to `minidom::Element` that reimplements
`PartialEq`. Most checks will happen in there, variables in attributes will
also be read at this time.
`PartialEq` is only implemented for `Element` as it wouldn't make sense to
compare two `ScanElement`s.
This interface may change in the future as it doesn't allow returning a Result
(errors may happen when parsing variables: missing from context, etc.).
Currently when a referenced `client` doesn't exist in context, the comparison
fails. If no context has been specified, comparison will go on, skipping
variable handling.
`minidom::Element` requires every element to be namespaced and `ScanElement`
has no special treatment for this. Be sure to include namespaces in your
`Element`s. You may want to use `Element::from_reader_with_prefixes`.
Namespaced attributes aren't yet handled by minidom so `scansion:strict`
also isn't treated in any special way.
# Reporting bugs