openalm / Extension-UtilitiesPack

Release Management utility tasks
Other
34 stars 38 forks source link

Tokenization updates only attribute, not XML element text #68

Open jondavis-ineight opened 7 years ago

jondavis-ineight commented 7 years ago

Only attributes can be tokenized, it seems. So if you have something like ..

<MyProperty>myvalue (replace this)</MyProperty>

.. it won't tokenize. Line 80:

    if ($node) {
        try {
            Write-Host "Updating $($key.Attribute) of $($key.KeyName): $($key.Value)"
            $node.($key.Attribute) = $key.Value
        }
        catch {
            Write-Error "Failure while updating $($key.Attribute) of $($key.KeyName): $($key.Value)"
        }
    }

It should test to see if Attribute was specified, and replace the node's InnerText instead if not.

Symbianx commented 6 years ago

@harshil93 any update on this request?

harshil93 commented 6 years ago

@Symbianx I haven't actively worked on this and currently very busy in my day to day work. Although I am willing to accept pull requests if you want to contribute.

jd-porter commented 6 years ago

Hi there, This is possible with the extension as-is! For the example above, you'd specify a KeyName of

/MyProperty/text()

The text() function ensures that you're always selecting the innerText.