-
-
Notifications
You must be signed in to change notification settings - Fork 712
Description
Describe the bug
Before v4.48.1 XML namespaces were silently ignored, but #2487 introduced namespace-aware processing.
This change is backwards-incompatible and breaks existing logic which relies on the former behavior of yq to ignore XML namespaces.
Because there is no yq flag to control this behavior it is not possible to write yq parsers which work for v4.48 as well as v4.47.
Version of yq: 4.48.1
Operating system: linux
Installed via: binary release
Input XML
repository2-3.xml
<?xml version='1.0' encoding='utf-8'?>
<sdk:sdk-repository xmlns:sdk="http://schemas.android.com/sdk/android/repo/repository2/03" xmlns:common="http://schemas.android.com/repository/android/common/02" xmlns:sdk-common="http://schemas.android.com/sdk/android/repo/common/03" xmlns:generic="http://schemas.android.com/repository/android/generic/02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<remotePackage path="cmdline-tools;13.0">
<type-details xsi:type="generic:genericDetailsType"/>
<revision>
<major>13</major>
<minor>0</minor>
</revision>
<display-name>Android SDK Command-line Tools</display-name>
<uses-license ref="android-sdk-license"/>
<channelRef ref="channel-0"/>
<archives>
<archive>
<complete>
<size>157033049</size>
<checksum type="sha1">dcc85e607e53315fa67de2884ff7f623c60f15ae</checksum>
<url>commandlinetools-linux-11479570_latest.zip</url>
</complete>
<host-os>linux</host-os>
</archive>
</archives>
</remotePackage>
</sdk:sdk-repository>Command
The command you ran:
yq --input-format xml --output-format yaml '.sdk-repository' < repository2-3.xmlActual behavior
The result is null for v4.48.2
nullExpected behavior
The result should contain the content of the sdk-repository XML node as it did with 4.47.
+@xmlns:sdk: http://schemas.android.com/sdk/android/repo/repository2/03
+@xmlns:common: http://schemas.android.com/repository/android/common/02
+@xmlns:sdk-common: http://schemas.android.com/sdk/android/repo/common/03
+@xmlns:generic: http://schemas.android.com/repository/android/generic/02
+@xmlns:xsi: http://www.w3.org/2001/XMLSchema-instance
remotePackage:
+@path: cmdline-tools;13.0
type-details:
+@xsi:type: generic:genericDetailsType
revision:
major: "13"
minor: "0"
display-name: Android SDK Command-line Tools
uses-license:
+@ref: android-sdk-license
channelRef:
+@ref: channel-0
archives:
archive:
complete:
size: "157033049"
checksum:
+content: dcc85e607e53315fa67de2884ff7f623c60f15ae
+@type: sha1
url: commandlinetools-linux-11479570_latest.zip
host-os: linuxAdditional context
The new behavior should be locked behind a yq flag --xml-namespaces=true or similiar to preserve the former behavior.
To get the same result in v4.48 the following command works:
yq --input-format xml --output-format yaml '."sdk:sdk-repository"' < repository2-3.xmlUnfortunately the same command does not work in v4.47.