View Single Post
EightBitz
Senior Member
 
Join Date: May 2013
Posts: 1,458

Old February 16th, 2017, 05:09 PM
Quote:
Originally Posted by kbs666 View Post
Either there is something fishy with the editor you're using, seems likely according to Farling, or there is something wrong with the Powershell parser as compared to the XML standard which is also possible.
It's the PowerShell parser. Since there is nothing, absolutely nothing in that node, PowerShell doesn't automatically see it as an XML node. It sees it as an empty string.

I just found a way to force it to read it as an object, and it's parsing it correctly now.

As much as I like PowerShell, it does have its quirks. Variable types are dynamic. It doesn't have a clean, clear, reliable way to say, variable x will always be a string, and variable y will always be an integer. It does it on the fly.

In many cases, that's convenient, and in many cases, it's absolutely frustrating.

For anyone who's curious, instead of doing this:
Code:
$contents = $RWExportData.export.contents
I did this:
Code:
$contents = $RWExportData.export.ChildNodes | Where-Object {$_.name -eq "contents"}
And that did the trick. Problem is that when Powershell saves the edited xml, it saves it as formatted XML. So I may have to find or figure out that regex after all. We'll see how this import goes ...
EightBitz is offline   #20 Reply With Quote