Open Rex-Sanchez opened 5 days ago
Can you test with a valid struct ? The urn is a prefix, but no namespace is declared.
#[derive(YaSerialize, YaDeserialize, Debug, Default, Clone, Eq, PartialEq)]
#[yaserde(
namespaces = {
"urn" = "http://example.com/",
}
)]
struct Body {
#[yaserde(prefix = "urn")]
text: String,
}
Good day.. thx for the response..
im not sure what you mean by valid struct.. when i declare it with a namespace like above it does work but body should not have a namespace.. as in the thing im serialize and deserialize does not have a namespace on the body. as a example what im trying to serialize and deserialize
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:something" >
<soapenv:Header/>
<soapenv:Body>
<urn:getProducts>
<urn:manyfields>data in field</urn:manyfields>
</urn:getProducts>
</soapenv:Body>
</soapenv:Envelope>
as you can see there is no namespace one body, while the nested elements do have a prefix.
im am using 2 namespaces on the envelope like the following
#[derive(YaSerialize, YaDeserialize, Debug, Default, Clone, Eq, PartialEq)]
#[yaserde(
rename = "Envelope",
namespaces = {
"soapenv" = "http://schemas.xmlsoap.org/soap/envelope/",
"urn" = "urn:something"
},
prefix = "soapenv"
)]
pub struct SoapEnvelope<BODY>
The main issue is the miss of the declaration of "urn" = "urn:something"
Without that, no namespace prefix urn
is declared, so it cannot be handled correctly.
Im having trouble deserializing with prefixes
serializing the following:
this yields:
the text elements is serialized with the prefix
this now errors with
value: "text is a required field of Body"
when the prefix is removed from the text element it will serialize without a problem
if this xml is deserialized with the urn prefix on the text element. the prefix is ignored and the xml is deserialized without error.. so it seems that the deserializer is ignoring the prefix.