|
15 | 15 | //! Table of Contents |
16 | 16 | //! ================= |
17 | 17 | //! - [Mapping XML to Rust types](#mapping-xml-to-rust-types) |
| 18 | +//! - [Basics](#basics) |
18 | 19 | //! - [Optional attributes and elements](#optional-attributes-and-elements) |
19 | 20 | //! - [Choices (`xs:choice` XML Schema type)](#choices-xschoice-xml-schema-type) |
20 | 21 | //! - [Sequences (`xs:all` and `xs:sequence` XML Schema types)](#sequences-xsall-and-xssequence-xml-schema-types) |
|
27 | 28 | //! - [Enums and sequences of enums](#enums-and-sequences-of-enums) |
28 | 29 | //! - [Frequently Used Patterns](#frequently-used-patterns) |
29 | 30 | //! - [`<element>` lists](#element-lists) |
| 31 | +//! - [Overlapped (Out-of-Order) Elements](#overlapped-out-of-order-elements) |
30 | 32 | //! - [Enum::Unit Variants As a Text](#enumunit-variants-as-a-text) |
31 | 33 | //! - [Internally Tagged Enums](#internally-tagged-enums) |
32 | 34 | //! |
|
57 | 59 | //! |
58 | 60 | //! <table> |
59 | 61 | //! <thead> |
| 62 | +//! <tr><th colspan="2"> |
| 63 | +//! |
| 64 | +//! ## Basics |
| 65 | +//! |
| 66 | +//! </th></tr> |
60 | 67 | //! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr> |
61 | 68 | //! </thead> |
62 | 69 | //! <tbody style="vertical-align:top;"> |
|
990 | 997 | //! |
991 | 998 | //! NOTE: consequent text and CDATA nodes are merged into the one text node, |
992 | 999 | //! 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`]. |
993 | 1003 | //! </div> |
994 | 1004 | //! </td> |
995 | 1005 | //! </tr> |
|
1673 | 1683 | //! |
1674 | 1684 | //! Instead of writing such functions manually, you also could try <https://lib.rs/crates/serde-query>. |
1675 | 1685 | //! |
| 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 | +//! |
1676 | 1711 | //! Enum::Unit Variants As a Text |
1677 | 1712 | //! ----------------------------- |
1678 | 1713 | //! One frequent task and a typical mistake is to creation of mapping a text |
|
1755 | 1790 | //! macro documentation for details. |
1756 | 1791 | //! |
1757 | 1792 | //! |
| 1793 | +//! [`overlapped-lists`]: ../index.html#overlapped-lists |
1758 | 1794 | //! [specification]: https://www.w3.org/TR/xmlschema11-1/#Simple_Type_Definition |
1759 | 1795 | //! [`deserialize_with`]: https://serde.rs/field-attrs.html#deserialize_with |
1760 | 1796 | //! [#497]: https://github.com/tafia/quick-xml/issues/497 |
|
0 commit comments