Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConvertFrom-XmlNode - Boolean Values Are Always Returned As True #3

Open
dalgarin opened this issue Apr 9, 2020 · 0 comments
Open

Comments

@dalgarin
Copy link

dalgarin commented Apr 9, 2020

When processing boolean datatypes, the ConvertFrom-XmlNode function always returns true due to powershell conversion of string to bool vice int to bool:
PS C:\Users\user> [bool]0
False
PS C:\Users\user> [bool]1
True
PS C:\Users\user> [bool]"0"
True
PS C:\Users\user> [bool]"1"
True

In the switch statement, the value from XML is a string and so will always return true. Possible solution below would be to convert to int first and then boolean.
'boolean' {
bool
break
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant