mirror of
https://github.com/mikefarah/yq.git
synced 2025-02-05 21:57:08 +00:00
Updating docs for v4.25.3 release
This commit is contained in:
parent
b52d86e468
commit
68c5982ba5
46
usage/xml.md
46
usage/xml.md
@ -192,6 +192,52 @@ cat:
|
|||||||
# after cat
|
# after cat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Parse xml: keep attribute namespace
|
||||||
|
Given a sample.xml file of:
|
||||||
|
```xml
|
||||||
|
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<map xmlns="some-namespace" xmlns:xsi="some-instance" xsi:schemaLocation="some-url">
|
||||||
|
</map>
|
||||||
|
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq -p=xml -o=xml --xml-keep-namespace '.' sample.xml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```xml
|
||||||
|
<map xmlns="some-namespace" xmlns:xsi="some-instance" some-instance:schemaLocation="some-url"></map>
|
||||||
|
```
|
||||||
|
|
||||||
|
instead of
|
||||||
|
```xml
|
||||||
|
<map xmlns="some-namespace" xsi="some-instance" schemaLocation="some-url"></map>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Parse xml: keep raw attribute namespace
|
||||||
|
Given a sample.xml file of:
|
||||||
|
```xml
|
||||||
|
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<map xmlns="some-namespace" xmlns:xsi="some-instance" xsi:schemaLocation="some-url">
|
||||||
|
</map>
|
||||||
|
|
||||||
|
```
|
||||||
|
then
|
||||||
|
```bash
|
||||||
|
yq -p=xml -o=xml --xml-keep-namespace --xml-raw-token '.' sample.xml
|
||||||
|
```
|
||||||
|
will output
|
||||||
|
```xml
|
||||||
|
<map xmlns="some-namespace" xmlns:xsi="some-instance" xsi:schemaLocation="some-url"></map>
|
||||||
|
```
|
||||||
|
|
||||||
|
instead of
|
||||||
|
```xml
|
||||||
|
<map xmlns="some-namespace" xsi="some-instance" schemaLocation="some-url"></map>
|
||||||
|
```
|
||||||
|
|
||||||
## Encode xml: simple
|
## Encode xml: simple
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
|
Loading…
Reference in New Issue
Block a user