Stop defining namespaces through prefixes on fields
This commit is contained in:
parent
11cca274b2
commit
e9e339afc9
|
@ -10,7 +10,7 @@ struct NestedWrongNamespace {
|
||||||
#[derive(Debug, Eq, PartialEq, FromXml)]
|
#[derive(Debug, Eq, PartialEq, FromXml)]
|
||||||
#[xml(ns("URI", bar = "BAZ"))]
|
#[xml(ns("URI", bar = "BAZ"))]
|
||||||
struct NestedDe {
|
struct NestedDe {
|
||||||
#[xml(ns(bar))]
|
#[xml(ns("BAZ"))]
|
||||||
flag: bool,
|
flag: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ fn default_namespaces() {
|
||||||
#[derive(Debug, Eq, PartialEq, FromXml)]
|
#[derive(Debug, Eq, PartialEq, FromXml)]
|
||||||
#[xml(ns("URI", bar = "BAZ"))]
|
#[xml(ns("URI", bar = "BAZ"))]
|
||||||
struct NestedOtherNamespace {
|
struct NestedOtherNamespace {
|
||||||
#[xml(ns(bar))]
|
#[xml(ns("BAZ"))]
|
||||||
flag: bool,
|
flag: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ use instant_xml::{to_string, ToXml};
|
||||||
#[derive(Debug, Eq, PartialEq, ToXml)]
|
#[derive(Debug, Eq, PartialEq, ToXml)]
|
||||||
#[xml(ns(dar = "BAZ", internal = "INTERNAL"))]
|
#[xml(ns(dar = "BAZ", internal = "INTERNAL"))]
|
||||||
struct NestedDifferentNamespace {
|
struct NestedDifferentNamespace {
|
||||||
#[xml(ns(dar))]
|
|
||||||
flag_parent_prefix: bool,
|
|
||||||
#[xml(ns(internal))]
|
#[xml(ns(internal))]
|
||||||
flag_internal_prefix: bool,
|
flag_internal_prefix: bool,
|
||||||
}
|
}
|
||||||
|
@ -35,7 +33,6 @@ fn struct_child_namespaces() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
to_string(&StructChildNamespaces {
|
to_string(&StructChildNamespaces {
|
||||||
different_child_namespace: NestedDifferentNamespace {
|
different_child_namespace: NestedDifferentNamespace {
|
||||||
flag_parent_prefix: true,
|
|
||||||
flag_internal_prefix: false,
|
flag_internal_prefix: false,
|
||||||
},
|
},
|
||||||
same_child_namespace: Nested {
|
same_child_namespace: Nested {
|
||||||
|
@ -44,6 +41,6 @@ fn struct_child_namespaces() {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
"<StructChildNamespaces xmlns=\"URI\" xmlns:bar=\"BAZ\" xmlns:foo=\"BAR\"><NestedDifferentNamespace xmlns=\"\" xmlns:internal=\"INTERNAL\"><bar:flag_parent_prefix>true</bar:flag_parent_prefix><internal:flag_internal_prefix>false</internal:flag_internal_prefix></NestedDifferentNamespace><Nested xmlns:internal=\"INTERNAL\"><bar:flag_parent_prefix>true</bar:flag_parent_prefix><internal:flag_internal_prefix>false</internal:flag_internal_prefix></Nested></StructChildNamespaces>"
|
"<StructChildNamespaces xmlns=\"URI\" xmlns:bar=\"BAZ\" xmlns:foo=\"BAR\"><NestedDifferentNamespace xmlns=\"\" xmlns:internal=\"INTERNAL\"><internal:flag_internal_prefix>false</internal:flag_internal_prefix></NestedDifferentNamespace><Nested xmlns:internal=\"INTERNAL\"><bar:flag_parent_prefix>true</bar:flag_parent_prefix><internal:flag_internal_prefix>false</internal:flag_internal_prefix></Nested></StructChildNamespaces>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use instant_xml::{to_string, ToXml};
|
||||||
#[xml(ns(bar = "BAZ", foo = "BAR"))]
|
#[xml(ns(bar = "BAZ", foo = "BAR"))]
|
||||||
struct StructWithNamedFields {
|
struct StructWithNamedFields {
|
||||||
flag: bool,
|
flag: bool,
|
||||||
#[xml(ns(bar))]
|
#[xml(ns("BAZ"))]
|
||||||
string: String,
|
string: String,
|
||||||
#[xml(ns("typo"))]
|
#[xml(ns("typo"))]
|
||||||
number: i32,
|
number: i32,
|
||||||
|
|
|
@ -5,8 +5,6 @@ use instant_xml::{to_string, ToXml};
|
||||||
#[derive(Debug, Eq, PartialEq, ToXml)]
|
#[derive(Debug, Eq, PartialEq, ToXml)]
|
||||||
#[xml(ns("URI", dar = "BAZ", internal = "INTERNAL"))]
|
#[xml(ns("URI", dar = "BAZ", internal = "INTERNAL"))]
|
||||||
struct Nested {
|
struct Nested {
|
||||||
#[xml(ns(dar))]
|
|
||||||
flag_parent_prefix: bool,
|
|
||||||
#[xml(ns(internal))]
|
#[xml(ns(internal))]
|
||||||
flag_internal_prefix: bool,
|
flag_internal_prefix: bool,
|
||||||
}
|
}
|
||||||
|
@ -18,8 +16,6 @@ struct StructWithCustomField {
|
||||||
int_attribute: i32,
|
int_attribute: i32,
|
||||||
#[xml(ns("BAZ"))]
|
#[xml(ns("BAZ"))]
|
||||||
flag_direct_namespace_same_the_same_as_prefix: bool,
|
flag_direct_namespace_same_the_same_as_prefix: bool,
|
||||||
#[xml(ns(bar))]
|
|
||||||
flag_prefix: bool,
|
|
||||||
#[xml(ns("DIFFERENT"))]
|
#[xml(ns("DIFFERENT"))]
|
||||||
flag_direct_namespace: bool,
|
flag_direct_namespace: bool,
|
||||||
test: Nested,
|
test: Nested,
|
||||||
|
@ -40,14 +36,12 @@ fn struct_with_custom_field() {
|
||||||
to_string(&StructWithCustomField {
|
to_string(&StructWithCustomField {
|
||||||
int_attribute: 42,
|
int_attribute: 42,
|
||||||
flag_direct_namespace_same_the_same_as_prefix: true,
|
flag_direct_namespace_same_the_same_as_prefix: true,
|
||||||
flag_prefix: false,
|
|
||||||
flag_direct_namespace: true,
|
flag_direct_namespace: true,
|
||||||
test: Nested {
|
test: Nested {
|
||||||
flag_parent_prefix: true,
|
|
||||||
flag_internal_prefix: false,
|
flag_internal_prefix: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
"<StructWithCustomField xmlns=\"URI\" xmlns:bar=\"BAZ\" xmlns:foo=\"BAR\" int_attribute=\"42\"><flag_direct_namespace_same_the_same_as_prefix xmlns=\"BAZ\">true</flag_direct_namespace_same_the_same_as_prefix><bar:flag_prefix>false</bar:flag_prefix><flag_direct_namespace xmlns=\"DIFFERENT\">true</flag_direct_namespace><Nested xmlns:internal=\"INTERNAL\"><bar:flag_parent_prefix>true</bar:flag_parent_prefix><internal:flag_internal_prefix>false</internal:flag_internal_prefix></Nested></StructWithCustomField>"
|
"<StructWithCustomField xmlns=\"URI\" xmlns:bar=\"BAZ\" xmlns:foo=\"BAR\" int_attribute=\"42\"><flag_direct_namespace_same_the_same_as_prefix xmlns=\"BAZ\">true</flag_direct_namespace_same_the_same_as_prefix><flag_direct_namespace xmlns=\"DIFFERENT\">true</flag_direct_namespace><Nested xmlns:internal=\"INTERNAL\"><internal:flag_internal_prefix>false</internal:flag_internal_prefix></Nested></StructWithCustomField>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue