Skip to content

Commit

Permalink
Fix various grammar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Kriskras99 authored and dralley committed Jun 18, 2023
1 parent 5a536d0 commit 7640196
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 41 deletions.
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ default = []
async-tokio = ["tokio"]

## Enables support of non-UTF-8 encoded documents. Encoding will be inferred from
## the XML declaration if it will be found, otherwise UTF-8 is assumed.
## the XML declaration if it is found, otherwise UTF-8 is assumed.
##
## Currently, only ASCII-compatible encodings are supported, so, for example,
## Currently, only ASCII-compatible encodings are supported. For example,
## UTF-16 will not work (therefore, `quick-xml` is not [standard compliant]).
##
## Thus, quick-xml supports all encodings of [`encoding_rs`] except these:
## - [UTF-16BE]
## - [UTF-16LE]
## - [ISO-2022-JP]
##
## You should stop to process document when one of that encoding will be detected,
## You should stop processing a document when one of these encodings is detected,
## because generated events can be wrong and do not reflect a real document structure!
##
## Because there is only supported encodings that is not ASCII compatible, you can
## check for that to detect them:
## Because these are the only supported encodings that are not ASCII compatible, you can
## check for them:
##
## ```
## use quick_xml::events::Event;
Expand Down Expand Up @@ -102,7 +102,7 @@ async-tokio = ["tokio"]
## }
## assert_eq!(unsupported, true);
## ```
## That restriction will be eliminated once issue [#158] is resolved.
## This restriction will be eliminated once issue [#158] is resolved.
##
## [standard compliant]: https://www.w3.org/TR/xml11/#charencoding
## [UTF-16BE]: encoding_rs::UTF_16BE
Expand All @@ -120,7 +120,7 @@ encoding = ["encoding_rs"]
## [`unescape_with`]: crate::escape::unescape_with
escape-html = []

## This feature for a serde deserializer that enables support for deserializing
## This feature is for the Serde deserializer that enables support for deserializing
## lists where tags are overlapped with tags that do not correspond to the list.
##
## When this feature is enabled, the XML:
Expand Down Expand Up @@ -148,8 +148,8 @@ escape-html = []
## (duplicated field) when the deserializer encounters a second `<item/>`.
##
## Note, that enabling this feature can lead to high and even unlimited memory
## consumption, because deserializer should check all events up to the end of a
## container tag (`</any-name>` in that example) to figure out that there are no
## consumption, because deserializer needs to check all events up to the end of a
## container tag (`</any-name>` in this example) to figure out that there are no
## more items for a field. If `</any-name>` or even EOF is not encountered, the
## parsing will never end which can lead to a denial-of-service (DoS) scenario.
##
Expand All @@ -167,8 +167,8 @@ escape-html = []
## [`Deserializer`]: crate::de::Deserializer
overlapped-lists = []

## Enables serialization of some types using [`serde`]. Probably your rarely will
## need this feature enabled.
## Enables serialization of some quick-xml types using [`serde`]. This feature
## is rarely needed.
##
## This feature does NOT provide XML serializer or deserializer. You should use
## the `serialize` feature for that instead.
Expand Down
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
### Misc Changes

- [#594]: Add a helper macro to help deserialize internally tagged enums
with Serde, which doesn't work out-of-box due to serde limitations.
with Serde, which doesn't work out-of-the-box due to serde limitations.

[#581]: https://github.com/tafia/quick-xml/pull/581
[#594]: https://github.com/tafia/quick-xml/pull/594
Expand Down
50 changes: 24 additions & 26 deletions src/de/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Serde `Deserializer` module.
//!
//! Due to the complexity of the XML standard and the fact that serde was developed
//! with JSON in mind, not all serde concepts apply smoothly to XML. This leads to
//! that fact that some XML concepts are inexpressible in terms of serde derives
//! Due to the complexity of the XML standard and the fact that Serde was developed
//! with JSON in mind, not all Serde concepts apply smoothly to XML. This leads to
//! that fact that some XML concepts are inexpressible in terms of Serde derives
//! and may require manual deserialization.
//!
//! The most notable restriction is the ability to distinguish between _elements_
Expand Down Expand Up @@ -49,17 +49,15 @@
//!
//! <div style="background:rgba(120,145,255,0.45);padding:0.75em;">
//!
//! NOTE: examples, marked with `FIXME:` does not work yet -- any PRs that fixes
//! that are welcome! The message after marker is a test failure message.
//! Also, all that tests are marked with an `ignore` option, although their
//! compiles. This is by intention, because rustdoc marks such blocks with
//! an information icon unlike `no_run` blocks.
//! NOTE: All tests are marked with an `ignore` option, even though they do
//! compile. This is because rustdoc marks such blocks with an information
//! icon unlike `no_run` blocks.
//!
//! </div>
//!
//! <table>
//! <thead>
//! <tr><th>To parse all these XML's...</th><th>...use that Rust type(s)</th></tr>
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
//! </thead>
//! <tbody style="vertical-align:top;">
//! <tr>
Expand Down Expand Up @@ -262,7 +260,7 @@
//! ```
//! </td>
//! <td>
//! A structure where an each XML child element are mapped to the field.
//! A structure where each XML child element is mapped to the field.
//! Each element name becomes a name of field. The name of the struct itself
//! does not matter:
//!
Expand Down Expand Up @@ -364,7 +362,7 @@
//! ## Optional attributes and elements
//!
//! </th></tr>
//! <tr><th>To parse all these XML's...</th><th>...use that Rust type(s)</th></tr>
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
//! <!-- 6 ===================================================================================== -->
//! <tr>
//! <td>
Expand Down Expand Up @@ -458,7 +456,7 @@
//! ## Choices (`xs:choice` XML Schema type)
//!
//! </th></tr>
//! <tr><th>To parse all these XML's...</th><th>...use that Rust type(s)</th></tr>
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
//! <!-- 8 ===================================================================================== -->
//! <tr>
//! <td>
Expand All @@ -479,10 +477,10 @@
//! </td>
//! <td>
//!
//! An enum where each variant have a name of the possible root tag. The name of
//! An enum where each variant has the name of a possible root tag. The name of
//! the enum itself does not matter.
//!
//! If you need to get a textual content, mark a variant with `#[serde(rename = "$text")]`.
//! If you need to get the textual content, mark a variant with `#[serde(rename = "$text")]`.
//!
//! All these structs can be used to deserialize from any XML on the
//! left side depending on amount of information that you want to get:
Expand Down Expand Up @@ -840,7 +838,7 @@
//! ## Sequences (`xs:all` and `xs:sequence` XML Schema types)
//!
//! </th></tr>
//! <tr><th>To parse all these XML's...</th><th>...use that Rust type(s)</th></tr>
//! <tr><th>To parse all these XML's...</th><th>...use these Rust type(s)</th></tr>
//! <!-- 13 ==================================================================================== -->
//! <tr>
//! <td>
Expand All @@ -864,7 +862,7 @@
//! </td>
//! <td>
//!
//! A structure with a field which have a sequence type, for example, [`Vec`].
//! A structure with a field which is a sequence type, for example, [`Vec`].
//! Because XML syntax does not distinguish between empty sequences and missed
//! elements, we should indicate that on the Rust side, because serde will require
//! that field `item` exists. You can do that in two possible ways:
Expand Down Expand Up @@ -928,7 +926,7 @@
//! <!-- 14 ==================================================================================== -->
//! <tr>
//! <td>
//! A sequence with a strict order, probably with a mixed content
//! A sequence with a strict order, probably with mixed content
//! (text / CDATA and tags):
//!
//! ```xml
Expand Down Expand Up @@ -1303,7 +1301,7 @@
//! Composition Rules
//! =================
//!
//! XML format is very different from other formats supported by `serde`.
//! The XML format is very different from other formats supported by `serde`.
//! One such difference it is how data in the serialized form is related to
//! the Rust type. Usually each byte in the data can be associated only with
//! one field in the data structure. However, XML is an exception.
Expand Down Expand Up @@ -1352,7 +1350,7 @@
//! how you want to serialize certain constructs, which could be represented
//! through XML in multiple different ways.
//!
//! The only difference in how complex types and sequences are serialized.
//! The only difference is in how complex types and sequences are serialized.
//! If you doubt which one you should select, begin with [`$value`](#value).
//!
//! ## `$text`
Expand Down Expand Up @@ -1401,7 +1399,7 @@
//!
//! NOTE: a name `#content` would better explain the purpose of that field,
//! but `$value` is used for compatibility with other XML serde crates, which
//! uses that name. This allow you to switch XML crate more smoothly if required.
//! uses that name. This will allow you to switch XML crates more smoothly if required.
//! </div>
//!
//! Representation of primitive types in `$value` does not differ from their
Expand Down Expand Up @@ -1500,10 +1498,10 @@
//!
//! ### Structs and sequences of structs
//!
//! Note, that structures does not have serializable name as well (name of the
//! type are never used), so it is impossible to serialize non-unit struct or
//! Note, that structures do not have a serializable name as well (name of the
//! type is never used), so it is impossible to serialize non-unit struct or
//! sequence of non-unit structs in `$value` field. (sequences of) unit structs
//! are serialized as empty string, although, because units itself serializing
//! are serialized as empty string, because units itself serializing
//! to nothing:
//!
//! ```
Expand Down Expand Up @@ -1721,7 +1719,7 @@
//! </some-container>
//! ```
//!
//! After that you can find the correct solution, using the principles, explained
//! After that you can find the correct solution, using the principles explained
//! above. You should wrap `SomeEnum` into wrapper struct under the [`$text`](#text)
//! name:
//! ```
Expand Down Expand Up @@ -1749,10 +1747,10 @@
//! -----------------------
//! [Tagged enums] are currently not supported because of an issue in the Serde
//! design (see [serde#1183] and [quick-xml#586]) and missing optimizations in
//! serde which could be useful for XML case ([serde#1495]). This can be worked
//! Serde which could be useful for XML parsing ([serde#1495]). This can be worked
//! around by manually implementing deserialize with `#[serde(deserialize_with = "func")]`
//! or implementing [`Deserialize`], but this can get very tedious very fast for
//! files with large amounts of tagged enums. To help with this issue the quick-xml
//! files with large amounts of tagged enums. To help with this issue quick-xml
//! provides a macro [`impl_deserialize_for_internally_tagged_enum!`]. See the
//! macro documentation for details.
//!
Expand Down
6 changes: 3 additions & 3 deletions src/serde_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ macro_rules! deserialize_variant {
/// does not use [`Deserializer::deserialize_any`] that produces wrong results
/// with XML because of [serde#1183].
///
/// In contract to deriving [`Deserialize`] this macro assumes that a tag will be
/// In contrast to deriving [`Deserialize`] this macro assumes that a tag will be
/// the first element or attribute in the XML.
///
/// # Example
Expand Down Expand Up @@ -200,8 +200,8 @@ macro_rules! impl_deserialize_for_internally_tagged_enum {
/// and [`#[serde(serialize_with = "...")]`][se-with].
///
/// When you serialize unit variants of enums, they are serialized as an empty
/// elements, like `<Unit/>`. At the same time, when enum consist only from unit
/// variants, it is frequently needed to serialize them as string content of an
/// element, like `<Unit/>`. If your enum consist only of unit variants,
/// it is frequently required to serialize them as string content of an
/// element, like `<field>Unit</field>`. To make this possible use this module.
///
/// ```
Expand Down

0 comments on commit 7640196

Please sign in to comment.