mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
New xml format (#7947)
# Description Changes old `from xml` `to xml` data formats. See #7682 for reasoning behind this change. Output is now a series of records with `tag`, `attributes` and `content` fields. Old:  New:  # User-Facing Changes New output/input format, better error handling for `from xml` and `to xml` commands. # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
@ -179,7 +179,18 @@ fn parses_json() {
|
||||
fn parses_xml() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open jonathan.xml | get rss.children.channel.children | get 0.3.item.children | get 3.link.children.0"
|
||||
pipeline(r#"
|
||||
open jonathan.xml
|
||||
| get content
|
||||
| where tag == channel
|
||||
| get content
|
||||
| flatten
|
||||
| where tag == item
|
||||
| get content
|
||||
| flatten
|
||||
| where tag == guid
|
||||
| get content.0.content.0
|
||||
"#)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
|
@ -8,7 +8,15 @@ fn table_to_xml_text_and_from_xml_text_back_into_table() {
|
||||
open jonathan.xml
|
||||
| to xml
|
||||
| from xml
|
||||
| get rss.children.channel.children.0.3.item.children.guid.4.attributes.isPermaLink
|
||||
| get content
|
||||
| where tag == channel
|
||||
| get content
|
||||
| flatten
|
||||
| where tag == item
|
||||
| get content
|
||||
| flatten
|
||||
| where tag == guid
|
||||
| get 0.attributes.isPermaLink
|
||||
"#
|
||||
));
|
||||
|
||||
|
Reference in New Issue
Block a user