pub const NS_XS: xsd_parser_types::misc::Namespace =
xsd_parser_types::misc::Namespace::new_const(b"http://www.w3.org/2001/XMLSchema");
pub const NS_XML: xsd_parser_types::misc::Namespace =
xsd_parser_types::misc::Namespace::new_const(b"http://www.w3.org/XML/1998/namespace");
pub const NS_XSI: xsd_parser_types::misc::Namespace =
xsd_parser_types::misc::Namespace::new_const(b"http://www.w3.org/2001/XMLSchema-instance");
pub const PREFIX_XS: xsd_parser_types::misc::NamespacePrefix =
xsd_parser_types::misc::NamespacePrefix::new_const(b"xs");
pub const PREFIX_XML: xsd_parser_types::misc::NamespacePrefix =
xsd_parser_types::misc::NamespacePrefix::new_const(b"xml");
pub const PREFIX_XSI: xsd_parser_types::misc::NamespacePrefix =
xsd_parser_types::misc::NamespacePrefix::new_const(b"xsi");
pub type Foo = FooElementType;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct FooElementType {
pub bar: ::core::option::Option<FooBarElementType>,
}
impl ::xsd_parser_types::quick_xml::WithSerializer for FooElementType {
type Serializer<'x> = quick_xml_serialize::FooElementTypeSerializer<'x>;
fn serializer<'ser>(
&'ser self,
name: ::core::option::Option<&'ser ::core::primitive::str>,
is_root: ::core::primitive::bool,
) -> ::core::result::Result<Self::Serializer<'ser>, ::xsd_parser_types::quick_xml::Error> {
Ok(quick_xml_serialize::FooElementTypeSerializer {
value: self,
state: ::std::boxed::Box::new(
quick_xml_serialize::FooElementTypeSerializerState::Init__,
),
name: name.unwrap_or("Foo"),
is_root,
})
}
}
impl ::xsd_parser_types::quick_xml::WithDeserializer for FooElementType {
type Deserializer = quick_xml_deserialize::FooElementTypeDeserializer;
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct FooBarElementType {
pub baz: ::std::string::String,
pub content: ::core::primitive::bool,
}
impl ::xsd_parser_types::quick_xml::WithSerializer for FooBarElementType {
type Serializer<'x> = quick_xml_serialize::FooBarElementTypeSerializer<'x>;
fn serializer<'ser>(
&'ser self,
name: ::core::option::Option<&'ser ::core::primitive::str>,
is_root: ::core::primitive::bool,
) -> ::core::result::Result<Self::Serializer<'ser>, ::xsd_parser_types::quick_xml::Error> {
Ok(quick_xml_serialize::FooBarElementTypeSerializer {
value: self,
state: ::std::boxed::Box::new(
quick_xml_serialize::FooBarElementTypeSerializerState::Init__,
),
name: name.unwrap_or("FooBar"),
is_root,
})
}
}
impl ::xsd_parser_types::quick_xml::WithDeserializer for FooBarElementType {
type Deserializer = quick_xml_deserialize::FooBarElementTypeDeserializer;
}
pub mod quick_xml_deserialize {
use xsd_parser_types::quick_xml::Deserializer as _;
#[derive(Debug)]
pub struct FooElementTypeDeserializer {
bar: ::core::option::Option<super::FooBarElementType>,
state__: ::std::boxed::Box<FooElementTypeDeserializerState>,
}
#[derive(Debug)]
enum FooElementTypeDeserializerState {
Init__ , Bar (:: core :: option :: Option << super :: FooBarElementType as :: xsd_parser_types :: quick_xml :: WithDeserializer > :: Deserializer >) , Done__ , Unknown__ , }
impl FooElementTypeDeserializer {
fn from_bytes_start(
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
bytes_start: &::xsd_parser_types::quick_xml::BytesStart<'_>,
) -> ::core::result::Result<Self, ::xsd_parser_types::quick_xml::Error> {
for attrib in helper.filter_xmlns_attributes(bytes_start) {
let attrib = attrib?;
helper.raise_unexpected_attrib_checked(&attrib)?;
}
Ok(Self {
bar: None,
state__: ::std::boxed::Box::new(FooElementTypeDeserializerState::Init__),
})
}
fn finish_state(
&mut self,
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
state: FooElementTypeDeserializerState,
) -> ::core::result::Result<(), ::xsd_parser_types::quick_xml::Error> {
use FooElementTypeDeserializerState as S;
match state {
S::Bar(Some(deserializer)) => self.store_bar(deserializer.finish(helper)?)?,
_ => (),
}
Ok(())
}
fn store_bar(
&mut self,
value: super::FooBarElementType,
) -> ::core::result::Result<(), ::xsd_parser_types::quick_xml::Error> {
if self.bar.is_some() {
Err(::xsd_parser_types::quick_xml::ErrorKind::DuplicateElement(
::xsd_parser_types::quick_xml::RawByteStr::from_slice(b"Bar"),
))?;
}
self.bar = Some(value);
Ok(())
}
fn handle_bar<'de>(
&mut self,
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
output: ::xsd_parser_types::quick_xml::DeserializerOutput<
'de,
super::FooBarElementType,
>,
fallback: &mut ::core::option::Option<FooElementTypeDeserializerState>,
) -> ::core::result::Result<
::xsd_parser_types::quick_xml::ElementHandlerOutput<'de>,
::xsd_parser_types::quick_xml::Error,
> {
use FooElementTypeDeserializerState as S;
let ::xsd_parser_types::quick_xml::DeserializerOutput {
artifact,
event,
allow_any,
} = output;
if artifact.is_none() {
*self.state__ = S::Done__;
return Ok(
::xsd_parser_types::quick_xml::ElementHandlerOutput::from_event(
event, allow_any,
),
);
}
if let Some(fallback) = fallback.take() {
self.finish_state(helper, fallback)?;
}
match artifact {
::xsd_parser_types::quick_xml::DeserializerArtifact::None => unreachable!(),
::xsd_parser_types::quick_xml::DeserializerArtifact::Data(data) => {
self.store_bar(data)?;
*self.state__ = S::Done__;
Ok(
::xsd_parser_types::quick_xml::ElementHandlerOutput::from_event(
event, allow_any,
),
)
}
::xsd_parser_types::quick_xml::DeserializerArtifact::Deserializer(deserializer) => {
fallback.get_or_insert(S::Bar(Some(deserializer)));
*self.state__ = S::Done__;
Ok(
::xsd_parser_types::quick_xml::ElementHandlerOutput::from_event(
event, allow_any,
),
)
}
}
}
}
impl<'de> ::xsd_parser_types::quick_xml::Deserializer<'de, super::FooElementType>
for FooElementTypeDeserializer
{
fn init(
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
event: ::xsd_parser_types::quick_xml::Event<'de>,
) -> ::xsd_parser_types::quick_xml::DeserializerResult<'de, super::FooElementType> {
helper.init_deserializer_from_start_event(event, Self::from_bytes_start)
}
fn next(
mut self,
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
event: ::xsd_parser_types::quick_xml::Event<'de>,
) -> ::xsd_parser_types::quick_xml::DeserializerResult<'de, super::FooElementType> {
use FooElementTypeDeserializerState as S;
let mut event = event;
let mut fallback = None;
let mut allow_any_element = false;
let (event, allow_any) = loop {
let state = ::core::mem::replace(&mut *self.state__, S::Unknown__);
event = match (state, event) {
(S::Unknown__, _) => unreachable!(),
(S::Bar(Some(deserializer)), event) => {
let output = deserializer.next(helper, event)?;
match self.handle_bar(helper, output, &mut fallback)? {
::xsd_parser_types::quick_xml::ElementHandlerOutput::Continue {
event,
allow_any,
} => {
allow_any_element = allow_any_element || allow_any;
event
}
::xsd_parser_types::quick_xml::ElementHandlerOutput::Break {
event,
allow_any,
} => break (event, allow_any),
}
}
(_, ::xsd_parser_types::quick_xml::Event::End(_)) => {
if let Some(fallback) = fallback.take() {
self.finish_state(helper, fallback)?;
}
return Ok(::xsd_parser_types::quick_xml::DeserializerOutput {
artifact: ::xsd_parser_types::quick_xml::DeserializerArtifact::Data(
self.finish(helper)?,
),
event: ::xsd_parser_types::quick_xml::DeserializerEvent::None,
allow_any: false,
});
}
(S::Init__, event) => {
fallback.get_or_insert(S::Init__);
*self.state__ = S::Bar(None);
event
}
(
S::Bar(None),
event @ (::xsd_parser_types::quick_xml::Event::Start(_)
| ::xsd_parser_types::quick_xml::Event::Empty(_)),
) => {
let output =
helper.init_start_tag_deserializer(event, None, b"Bar", false)?;
match self.handle_bar(helper, output, &mut fallback)? {
::xsd_parser_types::quick_xml::ElementHandlerOutput::Continue {
event,
allow_any,
} => {
allow_any_element = allow_any_element || allow_any;
event
}
::xsd_parser_types::quick_xml::ElementHandlerOutput::Break {
event,
allow_any,
} => break (event, allow_any),
}
}
(S::Done__, event) => {
*self.state__ = S::Done__;
break (
::xsd_parser_types::quick_xml::DeserializerEvent::Continue(event),
allow_any_element,
);
}
(state, event) => {
*self.state__ = state;
break (
::xsd_parser_types::quick_xml::DeserializerEvent::Break(event),
false,
);
}
}
};
if let Some(fallback) = fallback {
*self.state__ = fallback;
}
Ok(::xsd_parser_types::quick_xml::DeserializerOutput {
artifact: ::xsd_parser_types::quick_xml::DeserializerArtifact::Deserializer(self),
event,
allow_any,
})
}
fn finish(
mut self,
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
) -> ::core::result::Result<super::FooElementType, ::xsd_parser_types::quick_xml::Error>
{
let state = ::core::mem::replace(
&mut *self.state__,
FooElementTypeDeserializerState::Unknown__,
);
self.finish_state(helper, state)?;
Ok(super::FooElementType { bar: self.bar })
}
}
#[derive(Debug)]
pub struct FooBarElementTypeDeserializer {
baz: ::std::string::String,
content: ::core::option::Option<::core::primitive::bool>,
state__: ::std::boxed::Box<FooBarElementTypeDeserializerState>,
}
#[derive(Debug)]
enum FooBarElementTypeDeserializerState {
Init__ , Content__ (< :: core :: primitive :: bool as :: xsd_parser_types :: quick_xml :: WithDeserializer > :: Deserializer) , Unknown__ , }
impl FooBarElementTypeDeserializer {
fn from_bytes_start(
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
bytes_start: &::xsd_parser_types::quick_xml::BytesStart<'_>,
) -> ::core::result::Result<Self, ::xsd_parser_types::quick_xml::Error> {
let mut baz: ::core::option::Option<::std::string::String> = None;
for attrib in helper.filter_xmlns_attributes(bytes_start) {
let attrib = attrib?;
if attrib.key.local_name().as_ref() == b"Baz" {
helper.read_attrib(&mut baz, b"Baz", &attrib.value)?;
} else {
helper.raise_unexpected_attrib_checked(&attrib)?;
}
}
Ok(Self {
baz: baz.ok_or_else(|| {
::xsd_parser_types::quick_xml::ErrorKind::MissingAttribute("Baz".into())
})?,
content: None,
state__: ::std::boxed::Box::new(FooBarElementTypeDeserializerState::Init__),
})
}
fn finish_state(
&mut self,
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
state: FooBarElementTypeDeserializerState,
) -> ::core::result::Result<(), ::xsd_parser_types::quick_xml::Error> {
if let FooBarElementTypeDeserializerState::Content__(deserializer) = state {
self.store_content(deserializer.finish(helper)?)?;
}
Ok(())
}
fn store_content(
&mut self,
value: ::core::primitive::bool,
) -> ::core::result::Result<(), ::xsd_parser_types::quick_xml::Error> {
if self.content.is_some() {
Err(::xsd_parser_types::quick_xml::ErrorKind::DuplicateContent)?;
}
self.content = Some(value);
Ok(())
}
fn handle_content<'de>(
mut self,
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
output: ::xsd_parser_types::quick_xml::DeserializerOutput<'de, ::core::primitive::bool>,
) -> ::xsd_parser_types::quick_xml::DeserializerResult<'de, super::FooBarElementType>
{
use FooBarElementTypeDeserializerState as S;
let ::xsd_parser_types::quick_xml::DeserializerOutput {
artifact,
event,
allow_any,
} = output;
match artifact {
::xsd_parser_types::quick_xml::DeserializerArtifact::None => {
Ok(::xsd_parser_types::quick_xml::DeserializerOutput {
artifact: ::xsd_parser_types::quick_xml::DeserializerArtifact::None,
event,
allow_any,
})
}
::xsd_parser_types::quick_xml::DeserializerArtifact::Data(data) => {
self.store_content(data)?;
let data = self.finish(helper)?;
Ok(::xsd_parser_types::quick_xml::DeserializerOutput {
artifact: ::xsd_parser_types::quick_xml::DeserializerArtifact::Data(data),
event,
allow_any,
})
}
::xsd_parser_types::quick_xml::DeserializerArtifact::Deserializer(deserializer) => {
*self.state__ = S::Content__(deserializer);
Ok(::xsd_parser_types::quick_xml::DeserializerOutput {
artifact: ::xsd_parser_types::quick_xml::DeserializerArtifact::Deserializer(
self,
),
event,
allow_any,
})
}
}
}
}
impl<'de> ::xsd_parser_types::quick_xml::Deserializer<'de, super::FooBarElementType>
for FooBarElementTypeDeserializer
{
fn init(
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
event: ::xsd_parser_types::quick_xml::Event<'de>,
) -> ::xsd_parser_types::quick_xml::DeserializerResult<'de, super::FooBarElementType>
{
let (::xsd_parser_types::quick_xml::Event::Start(x)
| ::xsd_parser_types::quick_xml::Event::Empty(x)) = &event
else {
return Ok(::xsd_parser_types::quick_xml::DeserializerOutput {
artifact: ::xsd_parser_types::quick_xml::DeserializerArtifact::None,
event: ::xsd_parser_types::quick_xml::DeserializerEvent::Break(event),
allow_any: false,
});
};
Self::from_bytes_start(helper, x)?.next(helper, event)
}
fn next(
mut self,
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
event: ::xsd_parser_types::quick_xml::Event<'de>,
) -> ::xsd_parser_types::quick_xml::DeserializerResult<'de, super::FooBarElementType>
{
use FooBarElementTypeDeserializerState as S;
match ::core::mem::replace(&mut *self.state__, S::Unknown__) {
S::Unknown__ => unreachable!(),
S::Init__ => {
let output =
::xsd_parser_types::quick_xml::ContentDeserializer::init(helper, event)?;
self.handle_content(helper, output)
}
S::Content__(deserializer) => {
let output = deserializer.next(helper, event)?;
self.handle_content(helper, output)
}
}
}
fn finish(
mut self,
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
) -> ::core::result::Result<super::FooBarElementType, ::xsd_parser_types::quick_xml::Error>
{
let state = ::core::mem::replace(
&mut *self.state__,
FooBarElementTypeDeserializerState::Unknown__,
);
self.finish_state(helper, state)?;
Ok(super::FooBarElementType {
baz: self.baz,
content: helper.finish_content(self.content)?,
})
}
}
}
pub mod quick_xml_serialize {
use xsd_parser_types::quick_xml::Serializer as _;
#[derive(Debug)]
pub struct FooElementTypeSerializer<'ser> {
pub(super) value: &'ser super::FooElementType,
pub(super) state: ::std::boxed::Box<FooElementTypeSerializerState<'ser>>,
pub(super) name: &'ser ::core::primitive::str,
pub(super) is_root: ::core::primitive::bool,
}
#[derive(Debug)]
pub(super) enum FooElementTypeSerializerState<'ser> {
Init__,
Bar(
::xsd_parser_types::quick_xml::IterSerializer<
'ser,
::core::option::Option<&'ser super::FooBarElementType>,
super::FooBarElementType,
>,
),
End__,
Done__,
Phantom__(&'ser ()),
}
impl<'ser> FooElementTypeSerializer<'ser> {
fn next_event(
&mut self,
helper: &mut ::xsd_parser_types::quick_xml::SerializeHelper,
) -> ::core::result::Result<
::core::option::Option<::xsd_parser_types::quick_xml::Event<'ser>>,
::xsd_parser_types::quick_xml::Error,
> {
loop {
match &mut *self.state {
FooElementTypeSerializerState::Init__ => {
*self.state = FooElementTypeSerializerState::Bar(
::xsd_parser_types::quick_xml::IterSerializer::new(
self.value.bar.as_ref(),
Some("Bar"),
false,
),
);
let bytes = ::xsd_parser_types::quick_xml::BytesStart::new(self.name);
return Ok(Some(::xsd_parser_types::quick_xml::Event::Start(bytes)));
}
FooElementTypeSerializerState::Bar(x) => match x.next(helper).transpose()? {
Some(event) => return Ok(Some(event)),
None => *self.state = FooElementTypeSerializerState::End__,
},
FooElementTypeSerializerState::End__ => {
*self.state = FooElementTypeSerializerState::Done__;
return Ok(Some(::xsd_parser_types::quick_xml::Event::End(
::xsd_parser_types::quick_xml::BytesEnd::new(self.name),
)));
}
FooElementTypeSerializerState::Done__ => return Ok(None),
FooElementTypeSerializerState::Phantom__(_) => unreachable!(),
}
}
}
}
impl<'ser> ::xsd_parser_types::quick_xml::Serializer<'ser> for FooElementTypeSerializer<'ser> {
fn next(
&mut self,
helper: &mut ::xsd_parser_types::quick_xml::SerializeHelper,
) -> ::core::option::Option<
::core::result::Result<
::xsd_parser_types::quick_xml::Event<'ser>,
::xsd_parser_types::quick_xml::Error,
>,
> {
match self.next_event(helper) {
Ok(Some(event)) => Some(Ok(event)),
Ok(None) => None,
Err(error) => {
*self.state = FooElementTypeSerializerState::Done__;
Some(Err(error))
}
}
}
}
#[derive(Debug)]
pub struct FooBarElementTypeSerializer<'ser> {
pub(super) value: &'ser super::FooBarElementType,
pub(super) state: ::std::boxed::Box<FooBarElementTypeSerializerState<'ser>>,
pub(super) name: &'ser ::core::primitive::str,
pub(super) is_root: ::core::primitive::bool,
}
#[derive(Debug)]
pub(super) enum FooBarElementTypeSerializerState<'ser> {
Init__,
Content__(
<::core::primitive::bool as ::xsd_parser_types::quick_xml::WithSerializer>::Serializer<
'ser,
>,
),
End__,
Done__,
Phantom__(&'ser ()),
}
impl<'ser> FooBarElementTypeSerializer<'ser> {
fn next_event(
&mut self,
helper: &mut ::xsd_parser_types::quick_xml::SerializeHelper,
) -> ::core::result::Result<
::core::option::Option<::xsd_parser_types::quick_xml::Event<'ser>>,
::xsd_parser_types::quick_xml::Error,
> {
loop {
match &mut *self.state {
FooBarElementTypeSerializerState::Init__ => {
*self.state = FooBarElementTypeSerializerState::Content__(
::xsd_parser_types::quick_xml::WithSerializer::serializer(
&self.value.content,
None,
false,
)?,
);
let mut bytes = ::xsd_parser_types::quick_xml::BytesStart::new(self.name);
helper.write_attrib(&mut bytes, "Baz", &self.value.baz)?;
return Ok(Some(::xsd_parser_types::quick_xml::Event::Start(bytes)));
}
FooBarElementTypeSerializerState::Content__(x) => {
match x.next(helper).transpose()? {
Some(event) => return Ok(Some(event)),
None => *self.state = FooBarElementTypeSerializerState::End__,
}
}
FooBarElementTypeSerializerState::End__ => {
*self.state = FooBarElementTypeSerializerState::Done__;
return Ok(Some(::xsd_parser_types::quick_xml::Event::End(
::xsd_parser_types::quick_xml::BytesEnd::new(self.name),
)));
}
FooBarElementTypeSerializerState::Done__ => return Ok(None),
FooBarElementTypeSerializerState::Phantom__(_) => unreachable!(),
}
}
}
}
impl<'ser> ::xsd_parser_types::quick_xml::Serializer<'ser> for FooBarElementTypeSerializer<'ser> {
fn next(
&mut self,
helper: &mut ::xsd_parser_types::quick_xml::SerializeHelper,
) -> ::core::option::Option<
::core::result::Result<
::xsd_parser_types::quick_xml::Event<'ser>,
::xsd_parser_types::quick_xml::Error,
>,
> {
match self.next_event(helper) {
Ok(Some(event)) => Some(Ok(event)),
Ok(None) => None,
Err(error) => {
*self.state = FooBarElementTypeSerializerState::Done__;
Some(Err(error))
}
}
}
}
}
pub mod xs {
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct EntitiesType(pub ::std::vec::Vec<::std::string::String>);
impl ::xsd_parser_types::quick_xml::SerializeBytes for EntitiesType {
fn serialize_bytes(
&self,
helper: &mut ::xsd_parser_types::quick_xml::SerializeHelper,
) -> ::core::result::Result<
::core::option::Option<::std::borrow::Cow<'_, ::core::primitive::str>>,
::xsd_parser_types::quick_xml::Error,
> {
if self.0.is_empty() {
return Ok(None);
}
let mut data = ::std::string::String::new();
for item in &self.0 {
if let Some(bytes) = item.serialize_bytes(helper)? {
if !data.is_empty() {
data.push(' ');
}
data.push_str(&bytes);
}
}
Ok(Some(::std::borrow::Cow::Owned(data)))
}
}
impl xsd_parser_types::quick_xml::WithSerializeToBytes for EntitiesType {}
impl ::xsd_parser_types::quick_xml::DeserializeBytes for EntitiesType {
fn deserialize_bytes(
helper: &mut ::xsd_parser_types::quick_xml::DeserializeHelper,
bytes: &[::core::primitive::u8],
) -> ::core::result::Result<Self, ::xsd_parser_types::quick_xml::Error> {
Ok(Self(helper.deserialize_list(bytes)?))
}
}
impl xsd_parser_types::quick_xml::WithDeserializerFromBytes for EntitiesType {}
pub type EntityType = ::std::string::String;
pub type IdType = ::std::string::String;
pub type IdrefType = ::std::string::String;
pub type IdrefsType = EntitiesType;
pub type NcNameType = ::std::string::String;
pub type NmtokenType = ::std::string::String;
pub type NmtokensType = EntitiesType;
pub type NotationType = ::std::string::String;
pub type NameType = ::std::string::String;
pub type QNameType = ::std::string::String;
pub type AnySimpleType = ::std::string::String;
pub type AnyUriType = ::std::string::String;
pub type Base64BinaryType = ::std::string::String;
pub type BooleanType = ::core::primitive::bool;
pub type ByteType = ::core::primitive::i8;
pub type DateType = ::std::string::String;
pub type DateTimeType = ::std::string::String;
pub type DecimalType = ::core::primitive::f64;
pub type DoubleType = ::core::primitive::f64;
pub type DurationType = ::std::string::String;
pub type FloatType = ::core::primitive::f32;
pub type GDayType = ::std::string::String;
pub type GMonthType = ::std::string::String;
pub type GMonthDayType = ::std::string::String;
pub type GYearType = ::std::string::String;
pub type GYearMonthType = ::std::string::String;
pub type HexBinaryType = ::std::string::String;
pub type IntType = ::core::primitive::i32;
pub type IntegerType = ::core::primitive::i32;
pub type LanguageType = ::std::string::String;
pub type LongType = ::core::primitive::i64;
pub type NegativeIntegerType = ::core::num::NonZeroIsize;
pub type NonNegativeIntegerType = ::core::primitive::usize;
pub type NonPositiveIntegerType = ::core::primitive::isize;
pub type NormalizedStringType = ::std::string::String;
pub type PositiveIntegerType = ::core::num::NonZeroUsize;
pub type ShortType = ::core::primitive::i16;
pub type StringType = ::std::string::String;
pub type TimeType = ::std::string::String;
pub type TokenType = ::std::string::String;
pub type UnsignedByteType = ::core::primitive::u8;
pub type UnsignedIntType = ::core::primitive::u32;
pub type UnsignedLongType = ::core::primitive::u64;
pub type UnsignedShortType = ::core::primitive::u16;
}
The issue is present with xsd-parser v1.5.2, I also tried master branch with the same results.
Minimal reproducible example
Given the following XSD file:
And the following configuration in build.rs:
The following XML is validated by the XSD file:
But fails to be deserialized with the following error :
Error while deserializing XML content: Error { kind: UnknownOrInvalidValue(""), position: Some(159), elements: Some(["Foo"]) }It seems that the default value is not used for
Barelement, so the parser expects a boolean value.If the XML used is the following one instead, a value is provided, so no error are raised:
Here is the code generated by the xsd_parser library:
Details
Expected behavior
Since the first XML is valid, it should be deserialized correctly and use the default value when possible
Workaround
As a workaround, I have changed the extension type to be
xs:stringinstead ofxs:boolean, but this lowers the specification provided by the XSD file.Thank you in advance for your help!