5 Replies Latest reply on Aug 17, 2007 7:24 AM by Greg Dove

    xml help, cant get rid of the tags

    mr-m
      Hello,

      I am doing my first xml project. I can update a dynamic text box from a xml file on the server, but when the dynamic text box is populated the <tag> data</tag> appears. I only want the word "data" without all the <> </>. Any help would be great.

        • 1. Re: xml help, cant get rid of the tags
          Greg Dove Level 4
          Did you already parse the XML string into an XML object? To get from the tag node to the text value below you would normally need another .firstChild.nodeValue at the end of the code that accessed the tag node.

          However its difficult to be sure what your main issue is from your description - e.g. its not clear if your tags are intended to be html formatting that's not rendering for example, in which case you could be setting the text property and not htmlText (or perhaps you didn't set .html=true) for the text field. If the above doesn't help (or is difficult to understand) then please post your relevant code and I'll try to isolate the problem and explain further. (Post code using the Attach Code button to avoid display problems).

          • 2. Re: xml help, cant get rid of the tags
            mr-m Level 1
            Here is the code for when a button is pressed. Then the assignment is to fill a dynamic text box.


            var reviews_xml:XML = new XML();

            xml_btn.onRelease = function() {
            reviews_xml.load("lessons.xml");
            }

            reviews_xml.ignoreWhite = true;
            reviews_xml.onLoad = function (success:Boolean):Void {
            if (success) {
            homework_txt.text = reviews_xml.firstChild.firstChild.firstChild.nextSibling.nextSibling + "\n";


            } else {
            homework_txt.text = "Unable to load external file.";
            }
            }
            • 3. Re: xml help, cant get rid of the tags
              Greg Dove Level 4
              try this:

              homework_txt.text = reviews_xml.firstChild.firstChild.firstChild.nextSibling.nextSibling.firstChild.nodeValue + "\n";
              • 4. Re: xml help, cant get rid of the tags
                mr-m Level 1
                Thankyou so much, you have really helped me. I am trying to find an easy way for teachers to post homework assingments for under privilaged children.
                • 5. Re: xml help, cant get rid of the tags
                  Greg Dove Level 4
                  No problem. Happy to help.