This commit is contained in:
Mike Farah
2021-12-21 16:08:37 +11:00
parent 851a43b9b6
commit ae8df5ea87
3 changed files with 87 additions and 20 deletions
+21
View File
@@ -120,3 +120,24 @@ will output
</pets>
```
## Encode xml: attributes
Fields with the matching xml-attribute-prefix are assumed to be attributes.
Given a sample.yml file of:
```yaml
cat:
+name: tiger
meows: true
```
then
```bash
yq e -o=xml '.' sample.yml
```
will output
```xml
<cat name="tiger">
<meows>true</meows>
</cat>
```