Line breaks for flash in xml

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)

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

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 :wink:

I told you on MSN, use CDATA :wink:


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

then use somethingNodeObject.firstChild.nodeValue to receive some<br />thing :slight_smile:

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

thx anyway :wink:

Well there is allways the AS way out :slight_smile:

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


  // 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);
  

:slight_smile:

that’s a useful bit of code