# Create XML Node

**URL:** https://www.finalbuilder.com/forums/t/create-xml-node/2380
**Category:** Discussion
**Created:** [May 20, 2015, 6:46am UTC](https://www.finalbuilder.com/forums/t/create-xml-node/2380 "2015-05-20T06:46:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jim\_shawver](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@jim\_shawver](https://www.finalbuilder.com/forums/u/jim_shawver)
#### Post date: [May 20, 2015, 6:46am UTC](https://www.finalbuilder.com/forums/t/create-xml-node/2380/1 "2015-05-20T06:46:25Z")

</div>

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?`

---

<div class="post-metadata">

### Author: ![jim\_shawver](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@jim\_shawver](https://www.finalbuilder.com/forums/u/jim_shawver)
#### Post date: [May 20, 2015, 6:52am UTC](https://www.finalbuilder.com/forums/t/create-xml-node/2380/2 "2015-05-20T06:52:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![nevar](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/c4cdca/32.png) [@nevar](https://www.finalbuilder.com/forums/u/nevar)
#### Post date: [May 21, 2015, 2:27am UTC](https://www.finalbuilder.com/forums/t/create-xml-node/2380/3 "2015-05-21T02:27:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![nevar](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/c4cdca/32.png) [@nevar](https://www.finalbuilder.com/forums/u/nevar)
#### Post date: [May 21, 2015, 2:37am UTC](https://www.finalbuilder.com/forums/t/create-xml-node/2380/4 "2015-05-21T02:37:52Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jim\_shawver](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/3e96dc/32.png) [@jim\_shawver](https://www.finalbuilder.com/forums/u/jim_shawver)
#### Post date: [May 21, 2015, 4:12am UTC](https://www.finalbuilder.com/forums/t/create-xml-node/2380/5 "2015-05-21T04:12:27Z")

</div>

Thanks. I think I ended up doing it a slightly different way, but I got the desired result:  
  
&nbsp;&nbsp;&nbsp; Define XML Document  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Load document from file  
&nbsp;&nbsp;&nbsp; Create XML Node (using XML Document)  
&nbsp;&nbsp;&nbsp; Save XML Document  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Pretty Format XML  
  
This preserved the structure of the XML.
