Hi Juergen,
> can you provide examples where this particular type is useful?
Useful in many contexts. For instance:
list user {
key name;
leaf name {
type string;
}
leaf password {
type string;
}
The following instance document is valid:
<user>
<name/>
<password/>
</user>
Adding pattern statements works, but gets old after awhile. A built-in type
would be helpful.
> Or were
> you generally looking for a type to name things and the XSD token type
> was the first one that came your mind?
Yes, from past-life experience with XSD, I found "token" and "normalizedString"
useful (https://www.w3schools.com/XML/schema_dtypes_string.asp
<https://www.w3schools.com/XML/schema_dtypes_string.asp>). However, those
types
do not fully express what I really want (including, e.g., non-empty), which is:
a) a type for a non-empty, stripped, printable string that MAY contain internal
'space' characters.
b) a type for a non-empty, stripped, printable string that MAY NOT contain
internal 'space' characters.
/kw
> If the goal is to define a type for identifiers, then we likely should
> follow the Unicode standard annex UAX-31 and make use of <XID_Start>
> <XID_Continue>, which is what I think Python3 and Rust are using as
> the basis for their notion of language identifiers (but then the
> Unicode definitions are also criticized as buggy). A challenge is that
> the definition of <XID_Start> and <XID_Continue> seems to evolve with
> the unicode version. And once you start digging into the various
> attempts of modern programming languages to support internationalized
> identifiers, you discover that this is far from trivial to get right.
>
> /js
>
> On Thu, Apr 18, 2019 at 04:51:21AM +0000, Kent Watsen wrote:
>>
>> Many times in models I want a non-empty version of what XSD calls a "token":
>>
>> token A string that does not contain line feeds,
>> carriage returns, tabs, leading or trailing
>> spaces, or multiple spaces.
>>
>> So how about the following?
>>
>> typedef token {
>> type string;
>> length "1.max"; // non-empty (some expr do this already)
>> pattern "[^\n\r\t"]+" // no LFs, CRs, or Tabs
>> pattern "[^ ].*"; // no leading space (min-length 1?)
>> pattern ".*[^ ]"; // no trailing space (min-length 1?)
>> pattern ".*[^ ][^ ].*" // no multiple spaces (min-length 2?)
>> }
>>
>> Kent // contributor
>>
>>
>> _______________________________________________
>> netmod mailing list
>> [email protected]
>> https://www.ietf.org/mailman/listinfo/netmod
>
> --
> Juergen Schoenwaelder Jacobs University Bremen gGmbH
> Phone: +49 421 200 3587 Campus Ring 1 | 28759 Bremen | Germany
> Fax: +49 421 200 3103 <https://www.jacobs-university.de/>
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod