# XML string with return sign

**URL:** https://discourse.processing.org/t/xml-string-with-return-sign/22102
**Category:** Coding Questions
**Created:** [June 23, 2020, 3:33pm UTC](https://discourse.processing.org/t/xml-string-with-return-sign/22102 "2020-06-23T15:33:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)
#### Post date: [June 23, 2020, 3:33pm UTC](https://discourse.processing.org/t/xml-string-with-return-sign/22102/1 "2020-06-23T15:33:57Z")

</div>

Hi,  
I put back in a XML file a string with many lines.  
But after record it I have only one lines.

```auto
txt.setContent(t.getTxt()); //txt is my xml node

```

What is missing ?

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [June 23, 2020, 3:42pm UTC](https://discourse.processing.org/t/xml-string-with-return-sign/22102/2 "2020-06-23T15:42:02Z")

</div>

What is t again?

Chrisir

---

<div class="post-metadata">

### Author: ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)
#### Post date: [June 23, 2020, 3:50pm UTC](https://discourse.processing.org/t/xml-string-with-return-sign/22102/3 "2020-06-23T15:50:13Z")

</div>

t is one of the object which with this function return a string.  
I have no errors except the txt indent uncorrect

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [June 23, 2020, 4:37pm UTC](https://discourse.processing.org/t/xml-string-with-return-sign/22102/4 "2020-06-23T16:37:41Z")

</div>

> [@matheplica](#):
>
> `t.getTxt()`

Did you write this function? Then insert `"\n"`

I can’t help you with that.

---

<div class="post-metadata">

### Author: ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)
#### Post date: [June 23, 2020, 5:06pm UTC](https://discourse.processing.org/t/xml-string-with-return-sign/22102/5 "2020-06-23T17:06:21Z")

</div>

I tried to modificate the getTxt() function like this :

```auto
 String getTxt() {
        String t[] = txt.split("\n");
        String t2[] = new String[t.length];
        String ft = "";
        for (int i=0; i<t.length; i++) {
            t2[i] = trim(t[i]);
            t2[i]+="\n";
            ft += t2[i];
        }
        return ft;
    }

```

But he forget always to write the ("\n") sign the xml.  
I think this function is useless.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [June 23, 2020, 9:33pm UTC](https://discourse.processing.org/t/xml-string-with-return-sign/22102/6 "2020-06-23T21:33:53Z")

</div>

you don’t provide enough context

Did you try

```auto
println(t.length);    

```

after `String t[] = txt.split("\n");` ?

Maybe t[] is empty?
