This commit is contained in:
Mike Farah
2021-12-21 15:56:08 +11:00
parent df32baedf1
commit 851a43b9b6
3 changed files with 204 additions and 14 deletions
+38 -4
View File
@@ -19,7 +19,7 @@ Given a sample.xml file of:
```
then
```bash
yq e sample.xml
yq e -p=xml '.' sample.xml
```
will output
```yaml
@@ -37,7 +37,7 @@ Given a sample.xml file of:
```
then
```bash
yq e sample.xml
yq e -p=xml '.' sample.xml
```
will output
```yaml
@@ -58,7 +58,7 @@ Given a sample.xml file of:
```
then
```bash
yq e sample.xml
yq e -p=xml '.' sample.xml
```
will output
```yaml
@@ -77,7 +77,7 @@ Given a sample.xml file of:
```
then
```bash
yq e sample.xml
yq e -p=xml '.' sample.xml
```
will output
```yaml
@@ -86,3 +86,37 @@ cat:
+legs: "4"
```
## Encode xml: simple
Given a sample.yml file of:
```yaml
cat: purrs
```
then
```bash
yq e -o=xml '.' sample.yml
```
will output
```xml
<cat>purrs</cat>
```
## Encode xml: array
Given a sample.yml file of:
```yaml
pets:
cat:
- purrs
- meows
```
then
```bash
yq e -o=xml '.' sample.yml
```
will output
```xml
<pets>
<cat>purrs</cat>
<cat>meows</cat>
</pets>
```