Fixed issue where content surrounding tags are lost #1447

This commit is contained in:
Mike Farah
2022-11-27 17:29:27 +11:00
parent 43233ce62e
commit 02be2b2918
4 changed files with 77 additions and 14 deletions
+21
View File
@@ -152,6 +152,27 @@ cat:
+@legs: "4"
```
## Parse xml: content split between comments/children
Multiple content texts are collected into a sequence.
Given a sample.xml file of:
```xml
<root> value <!-- comment-->anotherValue <a>frog</a> cool!</root>
```
then
```bash
yq -p=xml '.' sample.xml
```
will output
```yaml
root:
+content: # comment
- value
- anotherValue
- cool!
a: frog
```
## Parse xml: custom dtd
DTD entities are processed as directives.