2 Replies Latest reply on Jan 30, 2007 8:09 AM by Newsgroup_User

    double quote in xml attribute

    Level 7
      Hi,

      I load several languages via utf8 encoded xml into my flash movie. To
      make it easier to parse I use the text as xml-attribute, but I noticed
      that a double quote will make it unable to load in flash. I tried to
      slash it but it doesn't work. Any ideas? Do I have to encode it by myself?

      TIA
        • 1. Re: double quote in xml attribute
          Jan-Paul K. Level 1
          putting character data into xml attributes is not a good practice, so first of all: If possible (even though you said you did it that way to make life easier) store your text as node values instead of attribute. Surrounded by <![CDATA[ ... ]]> you should have a well formed XML.

          If you want to use double quotes in an attribute value anyway, you might want to xml-encode the double-quotes. I guess &quot; (or &apos; for the single quote) should do the job.
          • 2. Re: double quote in xml attribute
            Level 7
            Jan-Paul K. wrote:
            > putting character data into xml attributes is not a good practice, so first of
            > all: If possible (even though you said you did it that way to make life easier)
            > store your text as node values instead of attribute.

            Node text values are looking a bit fuzzy to me in flash. I didn't find a
            rational way to parse it.

            > Surrounded by <![CDATA[
            > ... ]]> you should have a well formed XML.

            Ok, this does only work with node values right?

            > If you want to use double quotes in an attribute value anyway, you might want
            > to xml-encode the double-quotes. I guess ' (or &apos; for the single quote)
            > should do the job.

            You mean I should use a &qoute; for the " ?
            Doesn't look like flash has a function for xml-encoding and decoding. So
            I could parse it manually or look for htmlentities (is it the same like
            xml-encoding?).

            Thanks for you help!