# Line breaks for flash in xml

**URL:** https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439
**Category:** Uncategorized
**Created:** [July 4, 2004, 11:13am UTC](https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439 "2004-07-04T11:13:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![andr\_in](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/andr_in/32/37_2.png) [@andr\_in](https://forum.kirupa.com/u/andr_in)
#### Post date: [July 4, 2004, 11:13am UTC](https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439/1 "2004-07-04T11:13:29Z")

</div>

sup

I have a line in xml:  
\<tag something=“something” someotherthing=“some\<br /\>thing” /\>  
obviously I cannot use \<br /\> in “someotherthing”…bcuz it parses it as a new tag or something  
I tried with  
too but didn’t work :-/

I need a way to have line breaks in xml attribute values… (for flash)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 4, 2004, 12:42pm UTC](https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439/2 "2004-07-04T12:42:45Z")

</div>

attributes shouldn’t contain extensive data; maybe you can work around this by using a special char like “|” or “#” or whatever, and then parsing that in Flash and replace by newline…?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 4, 2004, 1:18pm UTC](https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439/3 "2004-07-04T13:18:46Z")

</div>

I thought of that too but if there’s a simpler way to do it with this bit of xml:  
\<somethin\>some\<br /\>thing\</something\> … then I’d like to hear it 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 4, 2004, 1:21pm UTC](https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439/4 "2004-07-04T13:21:56Z")

</div>

I told you on MSN, use CDATA 😉

```auto

<something> <![CDATA[some<br />thing]]></something>

```

then use _somethingNodeObject_.firstChild.nodeValue to receive some\<br /\>thing 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 4, 2004, 1:23pm UTC](https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439/5 "2004-07-04T13:23:49Z")

</div>

I tried… it didn’t say anywhee at w3schools that it doesn’t work with attributes :to:

thx anyway 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 4, 2004, 2:12pm UTC](https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439/6 "2004-07-04T14:12:43Z")

</div>

Well there is allways the AS way out 🙂

use \> for \> and \< for \< in you xml file.  
and decode it with AS

```auto

  // functions
 String.prototype.searchReplace = function(find, replace) {
      return this.split(find).join(replace);
  };
  String.prototype.encodeTags = function () {
      return this.searchReplace(">", "&gt;").searchReplace("<", "&lt;");
  };
  String.prototype.decodeTags = function () {
      return this.searchReplace("&gt;", ">").searchReplace("&lt;", "<");
  };
  // end functions
  
 test = "<b>LOL</b>lol";
  trace(test);
   test = test.encodeTags();
   trace(test);
   test = test.decodeTags();
   trace(test);
  

```

🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 4, 2004, 8:43pm UTC](https://forum.kirupa.com/t/line-breaks-for-flash-in-xml/56439/7 "2004-07-04T20:43:20Z")

</div>

that’s a useful bit of code
