none
How to compare two different XML and append the difference into one XML RRS feed

  • General discussion

  • Hi Team,

    I have two XML files XML1 and XML2. I have to compare both the XML's and append the delta to XML1.I need to achieve this via PowerShell Script.

    Example :

    XML1

    <BOOKS>
    <NAME>ALCHEMIST</NAME>
    <AUTHOR>PAULOCOEHLO</AUTHOR>
    <PAGES>225<PAGES>
    <GENRE>
    <FICTION>YES</FICTION>
    <MYTHS>NO<MYTHS>
    </GENRE>
    </BOOKS>

    XML2

    <BOOKS>
    <NAME>ALCHEMIST</NAME>
    <PRICE>100</PRICE> //-New Entry
    <PAGES>225<PAGES>
    <GENRE>
    <FICTION>YES</FICTION>
    <TRAVEL>NO</TRAVEL> //-New Entry
    </GENRE>
    </BOOKS>

    So here in XML2 i have two new entries ,i want to Compare XML1 and XML2 and want to append the XML1 with new entries of XML2 without removing anything from XML1. 


    Sunish Surendran.k


    • Edited by Sunish Surendran k Monday, January 8, 2018 12:52 PM
    • Changed type Bill_Stewart Wednesday, February 14, 2018 7:40 PM
    • Moved by Bill_Stewart Wednesday, February 14, 2018 7:40 PM This is not "scripts on demand"
    Monday, January 8, 2018 12:51 PM

All replies

  • This is not "code on demand." Read this first. It is the very first post from right at the top of this forum.

    This forum is for scripting questions rather than script requests


    -- Bill Stewart [Bill_Stewart]

    Monday, January 8, 2018 4:00 PM
    1. Learn PowerSHell
    2. Learn XML
    3. Learn XPath
    4. Use PowerShell with XPath queries to extract and compare books then extract XML fragment and compile into target XML object.

    If you are not a coder or programmer then I recommend contacting a consultant or programmer in your company to help you with this.


    \_(ツ)_/


    • Edited by jrv Monday, January 8, 2018 4:57 PM
    Monday, January 8, 2018 4:56 PM