-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for XML Schema xs:list
type
#376
Conversation
Now debug representation is readable
failures: de::tests::trivial::struct_::cdata::byte_buf de::tests::trivial::struct_::cdata::char_ de::tests::trivial::struct_::cdata::f32_ de::tests::trivial::struct_::cdata::f64_ de::tests::trivial::struct_::cdata::false_ de::tests::trivial::struct_::cdata::i128_ de::tests::trivial::struct_::cdata::i16_ de::tests::trivial::struct_::cdata::i32_ de::tests::trivial::struct_::cdata::i64_ de::tests::trivial::struct_::cdata::i8_ de::tests::trivial::struct_::cdata::isize_ de::tests::trivial::struct_::cdata::string de::tests::trivial::struct_::cdata::true_ de::tests::trivial::struct_::cdata::u128_ de::tests::trivial::struct_::cdata::u16_ de::tests::trivial::struct_::cdata::u32_ de::tests::trivial::struct_::cdata::u64_ de::tests::trivial::struct_::cdata::u8_ de::tests::trivial::struct_::cdata::usize_ de::tests::trivial::struct_::text::byte_buf
… trivial tests failures: de::tests::trivial::struct_::text::byte_buf de::tests::trivial::struct_::cdata::byte_buf
State::Attribute => { | ||
let decoder = self.de.reader.decoder(); | ||
match self.next_attr()? { | ||
Some(a) => seed.deserialize(EscapedDeserializer::new(a.value, decoder, true)), | ||
Some(a) => { | ||
//FIXME: we have to clone value because of wrong lifetimes on `a` | ||
// It should be bound to the input lifetime, but it instead bound | ||
// to a deserializer lifetime | ||
let value: Vec<_> = a.value.into_owned(); | ||
seed.deserialize(SimpleTypeDeserializer::new(value.into(), true, decoder)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a temporary solution. I'll remove this clone in next PRs, when I figure out how to do that. In any case, struct / map deserialization should be reviewed to match expectations that I documenting in #369
…tead of `BytesText` This commit revert changes from 85f9f68
No need to require that reader live as long as input from which it is borrow - we should be able to drop it if we don't need it anymore
@@ -35,9 +36,15 @@ impl<'de> Deserialize<'de> for ByteBuf { | |||
} | |||
} | |||
|
|||
impl fmt::Debug for ByteBuf { | |||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |||
write_byte_string(f, &self.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write_byte_string
could use some documentation
@@ -36,6 +36,8 @@ where | |||
let decoder = self.de.reader.decoder(); | |||
let de = match self.de.peek()? { | |||
DeEvent::Text(t) => EscapedDeserializer::new(Cow::Borrowed(t), decoder, true), | |||
// Escape sequences does not processed inside CDATA section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Escape sequences does not processed inside CDATA section | |
// Escape sequences are not processed inside CDATA section |
GitHub thinks that this PR coming from https://github.com/Mingun/fast-xml/tree/xs-list repo and I cannot change that, so I'll close it and make a new PR |
This PR allows deserializing
Vec
and other sequences from space-separated lists, as defined by XML Schema specification. So now this is possible:Deserialize
from
This PR is based on #374, because before parsing text/CDATA content I will need to fix CDATA handling. It also cancels change in the bytes deserializing: now it is again possible to get a raw content of the parsed buffer using deserializing into
Vec<u8>
/&[u8]
. This is not much useful in my opinion, although, so I put a TODO to look at this later.