Skip to content

Commit ad7553b

Browse files
authored
Merge pull request #647 from dev-ardi/master
add note for overlapping lists
2 parents 7866cf1 + d6d8abd commit ad7553b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/de/mod.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
//! Table of Contents
1616
//! =================
1717
//! - [Mapping XML to Rust types](#mapping-xml-to-rust-types)
18+
//! - [Basics](#basics)
1819
//! - [Optional attributes and elements](#optional-attributes-and-elements)
1920
//! - [Choices (`xs:choice` XML Schema type)](#choices-xschoice-xml-schema-type)
2021
//! - [Sequences (`xs:all` and `xs:sequence` XML Schema types)](#sequences-xsall-and-xssequence-xml-schema-types)
@@ -27,6 +28,7 @@
2728
//! - [Enums and sequences of enums](#enums-and-sequences-of-enums)
2829
//! - [Frequently Used Patterns](#frequently-used-patterns)
2930
//! - [`<element>` lists](#element-lists)
31+
//! - [Overlapped (Out-of-Order) Elements](#overlapped-out-of-order-elements)
3032
//! - [Enum::Unit Variants As a Text](#enumunit-variants-as-a-text)
3133
//! - [Internally Tagged Enums](#internally-tagged-enums)
3234
//!
@@ -57,6 +59,11 @@
5759
//!
5860
//! <table>
5961
//! <thead>
62+
//! <tr><th colspan="2">
63+
//!
64+
//! ## Basics
65+
//!
66+
//! </th></tr>
6067
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
6168
//! </thead>
6269
//! <tbody style="vertical-align:top;">
@@ -990,6 +997,9 @@
990997
//!
991998
//! NOTE: consequent text and CDATA nodes are merged into the one text node,
992999
//! so you cannot have two adjacent string types in your sequence.
1000+
//!
1001+
//! NOTE: In the case that the list might contain tags that are overlapped with
1002+
//! tags that do not correspond to the list you should add the feature [`overlapped-lists`].
9931003
//! </div>
9941004
//! </td>
9951005
//! </tr>
@@ -1673,6 +1683,31 @@
16731683
//!
16741684
//! Instead of writing such functions manually, you also could try <https://lib.rs/crates/serde-query>.
16751685
//!
1686+
//! Overlapped (Out-of-Order) Elements
1687+
//! ----------------------------------
1688+
//! In the case that the list might contain tags that are overlapped with
1689+
//! tags that do not correspond to the list (this is a usual case in XML
1690+
//! documents) like this:
1691+
//! ```xml
1692+
//! <any-name>
1693+
//! <item/>
1694+
//! <another-item/>
1695+
//! <item/>
1696+
//! <item/>
1697+
//! </any-name>
1698+
//! ```
1699+
//! you should enable the [`overlapped-lists`] feature to make it possible
1700+
//! to deserialize this to:
1701+
//! ```no_run
1702+
//! # use serde::Deserialize;
1703+
//! #[derive(Deserialize)]
1704+
//! #[serde(rename_all = "kebab-case")]
1705+
//! struct AnyName {
1706+
//! item: Vec<()>,
1707+
//! another_item: (),
1708+
//! }
1709+
//! ```
1710+
//!
16761711
//! Enum::Unit Variants As a Text
16771712
//! -----------------------------
16781713
//! One frequent task and a typical mistake is to creation of mapping a text
@@ -1755,6 +1790,7 @@
17551790
//! macro documentation for details.
17561791
//!
17571792
//!
1793+
//! [`overlapped-lists`]: ../index.html#overlapped-lists
17581794
//! [specification]: https://www.w3.org/TR/xmlschema11-1/#Simple_Type_Definition
17591795
//! [`deserialize_with`]: https://serde.rs/field-attrs.html#deserialize_with
17601796
//! [#497]: https://github.com/tafia/quick-xml/issues/497

0 commit comments

Comments
 (0)