Create XML Node

This is an example of the existing xml I am working with:

<products>
<product name="Bob">
<build>
<version>1.2.2version>
<date>05/17/15date>
build>
<build>
<version>1.2.1version>
<date>05/15/15date>
build>
product>
products>

I want to insert a new build node as the first child of the product node. When I use Create XML Node, the xml it inserts is valid, but the formatting is not very good:

<products>
<product name="Bob">
<build><version>1.2.3version>
<date>05/20/15date>build><build>
<version>1.2.2version>
<date>05/17/15date>
build>
<build>
<version>1.2.1version>
<date>05/15/15date>
build>
product>
products>

Is there a way to control where it places newlines so I can maintain the original structure of the xml?

Sorry, I didn’t realize the editor would process the xml tags. How do I enter xml tags so that it just displays them?

I have updated your post to use the code blocks. Sadly they aren’t the best to work with as you can see. They have removed some of the brackets, but it should be enough to work with here.

It turns out that you will need to save the xml to a temporary file using the pretty print option. Then read the xml back in once that has been done. This will get you the formatting you require.

Thanks. I think I ended up doing it a slightly different way, but I got the desired result:

    Define XML Document
        - Load document from file
    Create XML Node (using XML Document)
    Save XML Document
        - Pretty Format XML

This preserved the structure of the XML.