xso-proc: allow paths as XML names

Not sure if this is something useful to have, but it feels consistent
with `namespace`.
This commit is contained in:
Jonas Schäfer 2024-06-22 09:25:42 +02:00
commit 4d1166b66d
4 changed files with 82 additions and 30 deletions

View file

@ -148,3 +148,24 @@ fn empty_qname_check_has_precedence_over_attr_check() {
other => panic!("unexpected result: {:?}", other),
}
}
static SOME_NAME: &::xso::exports::rxml::strings::NcNameStr = {
#[allow(unsafe_code)]
unsafe {
::xso::exports::rxml::strings::NcNameStr::from_str_unchecked("bar")
}
};
#[derive(FromXml, IntoXml, PartialEq, Debug, Clone)]
#[xml(namespace = NS1, name = SOME_NAME)]
struct NamePath;
#[test]
fn name_path_roundtrip() {
#[allow(unused_imports)]
use std::{
option::Option::{None, Some},
result::Result::{Err, Ok},
};
roundtrip_full::<NamePath>("<bar xmlns='urn:example:ns1'/>");
}