pub struct Validate {
pub datatype: Option<Datatype>,
pub method: Option<Method>,
pub list_range: Option<ListRange>,
}
Expand description
Validation rules for a DataForms Field.
Fields§
§datatype: Option<Datatype>
The ‘datatype’ attribute specifies the datatype. This attribute is OPTIONAL, and defaults to “xs:string”. It MUST meet one of the following conditions:
- Start with “xs:”, and be one of the “built-in” datatypes defined in XML Schema Part 2
- Start with a prefix registered with the XMPP Registrar
- Start with “x:”, and specify a user-defined datatype.
Note that while “x:” allows for ad-hoc definitions, its use is NOT RECOMMENDED.
method: Option<Method>
The validation method. If no validation method is specified, form processors MUST
assume <basic/>
validation. The <validate/>
element SHOULD include one of the above
validation method elements, and MUST NOT include more than one.
Any validation method applied to a field of type “list-multi”, “list-single”, or “text-multi”
(other than <basic/>
) MUST imply the same behavior as <open/>
, with the additional constraints
defined by that method.
https://xmpp.org/extensions/xep-0122.html#usecases-validation
list_range: Option<ListRange>
For “list-multi”, validation can indicate (via the <list-range/>
element) that a minimum
and maximum number of options should be selected and/or entered. This selection range
MAY be combined with the other methods to provide more flexibility.
The <list-range/>
element SHOULD be included only when the <field/>
is of type “list-multi”
and SHOULD be ignored otherwise.
The <list-range/>
element SHOULD possess either a ‘min’ or ‘max’ attribute, and MAY possess
both. If neither attribute is included, the processor MUST assume that there are no
selection constraints.
Trait Implementations§
Source§impl AsXml for Validate
impl AsXml for Validate
Source§impl FromXml for Validate
impl FromXml for Validate
Source§fn from_events(
name: QName,
attrs: AttrMap,
ctx: &Context<'_>,
) -> Result<Self::Builder, FromEventsError>
fn from_events( name: QName, attrs: AttrMap, ctx: &Context<'_>, ) -> Result<Self::Builder, FromEventsError>
Source§fn xml_name_matcher() -> XmlNameMatcher<'static>
fn xml_name_matcher() -> XmlNameMatcher<'static>
Self
may be parsed from
a given XML element. Read more