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

Added new functions: replace and poke for inner xml #970

Merged
merged 2 commits into from
Oct 8, 2015

Commits on Oct 7, 2015

  1. Added new functions:

        XPathReplaceInnerText
        XmlPokeInnerText
        XPathReplaceInnerTextNS
        XmlPokeInnerTextNS
    
    The existing XPathReplace and XPathPoke functions are incapable of modifying the Value property of XmlNode. This is due to both Mono and .NET throwing an InvalidOperationException in the body of the XmlNode.Value property setter:
    
    Mono: https:/mosa/Mono-Class-Libraries/blob/master/mcs/class/System.XML/System.Xml/XmlNode.cs#L309
    .NET: https:/Microsoft/referencesource/blob/master/System.Xml/System/Xml/Dom/XmlNode.cs#L92
    
    I'm getting seeing that InvalidOperationException in practice in one of my FAKE build scripts. I know the XPath expression I'm using is valid; if I change it to be invalid, I get the "node not found" message.
    
    So, I've added some functions that allow updating the InnerText value of a node; something for which I have a need in my FAKE build scripts. InnerText IS a mutable property, unlike Value.
    
    Suggestion: Consider removing XPathReplace, XPathReplaceNS, XmlPoke, and XmlPokeNS. I'm not sure what purpose they serve, because they don't seem to work. XmlNode.Value is unsettable in both .NET and Mono.
    jsauvexamarin committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    36040c9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8ddd824 View commit details
    Browse the repository at this point in the history