I am adding some more tags in xml file by using DOM parser. I am creating some new tags using DOM parser and want to set their values by passing arraylist. My arraylist contains values which I am retrieving from database.

My code is a follows:

```
loading file using dom parser

  for(String s:a.List){
 Element n= doc.createElement("value");
n.appendChild(doc.createTextNode(String.valueOf(s)));

    }

```

here I am creating new tag and passing values of s in that tag.

```
Output I am getting:

<value>1</value>

<value>2</value>

<value>3</value>

<value>null</value>

<value>null</value>

<value>4</value>

```

;
;
so on

```
Expected output:

<value>1</value>
<value>2</value>

<value>3</value>

<value/>

<value/>

<value>4<value>

```

I want to remove null which is coming from databse to arraylist and than to xml and get form as mentioned above
Please help...