forked from extern/nushell
76
docs/commands/to-xml.md
Normal file
76
docs/commands/to-xml.md
Normal file
@ -0,0 +1,76 @@
|
||||
# to xml
|
||||
|
||||
Converts table data into XML text.
|
||||
|
||||
## Flags
|
||||
|
||||
- `-p`, `--pretty` \<integer>: Formats the XML text with the provided indentation setting
|
||||
|
||||
## Example
|
||||
|
||||
```shell
|
||||
> open jonathan.xml
|
||||
━━━━━━━━━━━━━━━━
|
||||
rss
|
||||
────────────────
|
||||
[table: 1 row]
|
||||
━━━━━━━━━━━━━━━━
|
||||
```
|
||||
|
||||
```shell
|
||||
> cat jonathan.xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<channel>
|
||||
<title>Jonathan Turner</title>
|
||||
<link>http://www.jonathanturner.org</link>
|
||||
<atom:link href="http://www.jonathanturner.org/feed.xml" rel="self" type="application/rss+xml" />
|
||||
|
||||
<item>
|
||||
<title>Creating crossplatform Rust terminal apps</title>
|
||||
<description><p><img src="/images/pikachu.jpg" alt="Pikachu animation in Windows" /></p>
|
||||
|
||||
<p><em>Look Mom, Pikachu running in Windows CMD!</em></p>
|
||||
|
||||
<p>Part of the adventure is not seeing the way ahead and going anyway.</p>
|
||||
</description>
|
||||
<pubDate>Mon, 05 Oct 2015 00:00:00 +0000</pubDate>
|
||||
<link>http://www.jonathanturner.org/2015/10/off-to-new-adventures.html</link>
|
||||
<guid isPermaLink="true">http://www.jonathanturner.org/2015/10/off-to-new-adventures.html</guid>
|
||||
</item>
|
||||
|
||||
</channel>
|
||||
|
||||
</rss>
|
||||
```
|
||||
|
||||
```shell
|
||||
> open jonathan.xml | to xml --pretty 2
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>Jonathan Turner</title>
|
||||
<link>http://www.jonathanturner.org</link>
|
||||
<link href="http://www.jonathanturner.org/feed.xml" rel="self" type="application/rss+xml">
|
||||
</link>
|
||||
<item>
|
||||
<title>Creating crossplatform Rust terminal apps</title>
|
||||
<description><p><img src="/images/pikachu.jpg" alt="Pikachu animation in Windows" /></p>
|
||||
|
||||
<p><em>Look Mom, Pikachu running in Windows CMD!</em></p>
|
||||
|
||||
<p>Part of the adventure is not seeing the way ahead and going anyway.</p>
|
||||
</description>
|
||||
<pubDate>Mon, 05 Oct 2015 00:00:00 +0000</pubDate>
|
||||
<link>http://www.jonathanturner.org/2015/10/off-to-new-adventures.html</link>
|
||||
<guid isPermaLink="true">http://www.jonathanturner.org/2015/10/off-to-new-adventures.html</guid>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
```
|
||||
|
||||
Due to XML and internal representation, `to xml` is currently limited, it will:
|
||||
|
||||
- only process table data loaded from XML files (e.g. `open file.json | to xml` will fail)
|
||||
- drop XML prolog declarations
|
||||
- drop namespaces
|
||||
- drop comments
|
Reference in New Issue
Block a user