@@ -161,6 +161,27 @@ fn ser_struct_default_namespace() {
|
||||
convert_and_validate!(model, content);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ser_struct_default_namespace_via_attribute() {
|
||||
#[derive(YaSerialize, PartialEq, Debug)]
|
||||
#[yaserde(
|
||||
root = "tt",
|
||||
default_namespace = "ttml",
|
||||
namespace = "ttml: http://www.w3.org/ns/ttml",
|
||||
namespace = "ttm: http://www.w3.org/ns/ttml#metadata"
|
||||
)]
|
||||
pub struct XmlStruct {
|
||||
item: String,
|
||||
}
|
||||
|
||||
let model = XmlStruct {
|
||||
item: "something".to_string(),
|
||||
};
|
||||
|
||||
let content = "<?xml version=\"1.0\" encoding=\"utf-8\"?><tt xmlns=\"http://www.w3.org/ns/ttml\" xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\"><item>something</item></tt>";
|
||||
convert_and_validate!(model, content);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn de_struct_namespace_nested() {
|
||||
#[derive(YaSerialize, Default, PartialEq, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user