to xml
for formats> to xml {flags}
--pretty, -p {int}
: Formats the XML text with the provided indentation settinginput | output |
---|---|
record | string |
Outputs an XML string representing the contents of this table
> {tag:noteattributes: {} content: [{tag:rememberattributes: {} content: [{tag:nullattrs:nullcontent:Event}]}]} |to xml
<note><remember>Event</remember></note>
When formatting xml null and empty record fields can be omitted and strings can be written without a wrapping record
> {tag:notecontent: [{tag:remembercontent: [Event]}]} |to xml
<note><remember>Event</remember></note>
Optionally, formats the text with a custom indentation setting
> {tag:notecontent: [{tag:remembercontent: [Event]}]} |to xml-p3
<note>
<remember>Event</remember>
</note>
Every XML entry is represented via a record with tag, attribute and content fields. To represent different types of entries different values must be written to this fields:
{tag: <tag name> attrs: {<attr name>: "<string value>" ...} content: [<entries>]}
{tag: '!' attrs: null content: "<comment string>"}
{tag: '?<pi name>' attrs: null content: "<pi content string>"}
{tag: null attrs: null content: "<text>"}
. Or as plain <text>
instead of record.Additionally any field which is: empty record, empty list or null, can be omitted.
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/to_xml.html