From e39be8749882be24eada22b6752c06ab5c87ae34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Wed, 19 Apr 2023 14:08:56 +0200 Subject: [PATCH] README: Add note about ScanElement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- README.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cd47eb8..c41f993 100644 --- a/README.md +++ b/README.md @@ -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