-
Board Idiot
' and & - a wrinkle to the special character problem
Hi all.
I have seen people having a similar problem as I am having, but mine's a tad different.
I have written some code that builds an XML file from ID3 information from mp3's. I have all the code fine, but when I trace the XML file, apostrophes and ampersands are represented as &apos and & repsectively. How do I convert these back to the original information within flash? I have seen escape and unescape used, but for the life of me, cannot figure out how to change it.
Any input would be greatly appreciated.
I don't have a bad sex life and I have the pictures to prove it.
-
FK'n_dog
try tracing the nodeValue
ie .. "Tate & Lyle"
parse and trace as xmlObj.firstChild - ouputs - "Tate & Lyle"
parse and trace as xmlObj.firstChild.nodeValue - ouputs - "Tate & Lyle"
or output to an html enabled textfield
-
Board Idiot
I think I see what you are saying. If I use just .firstChild, I will get the funky characters, whereas .firstChild.nodeValue will give the actual characters.
I'll give it a shot tonight - thanks!
I don't have a bad sex life and I have the pictures to prove it.
-
Board Idiot
My code works like this - I build an array with the information I need, then I populate an XML file with it.
What you are suggesting is for outputting from an XML file, correct? My issue is populating the XML file, I think.
Let me explain what I have done.
I started with an XML file I manually typed out. Here is the general layout:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<tracklist>
<Song track="" title="" link=""/>
</tracklist>
The <Song/> node has the attributes "track", "title", and "link" which are populated from the ID3 data (track and title) and a FileReferenceList (for the link). The attributes are where I'm getting the funny characters (specifically the title and link). For the title, I don't really care, but the link is to an mp3 file on my server and therefore needs to be accurate.
The XML file is populated correctly except for the characters. Is there a work-around I can use within flash?
I don't have a bad sex life and I have the pictures to prove it.
-
FK'n_dog
have you tried String.split, String.join ?
Code:
str = "$£split*this£$"
trace(str);
str = str.split("$").join("").split("£").join("").split("*").join(" ");
trace(str);
-
Board Idiot
Tried it tonight and that didn't work.
What is it about XML within flash that doesn't like & and '? The ID3 data is correct. I traced it and those characters are correct. However, when it's moved to the XML object and then traced, they are altered to & and '.
Is there a routine that goes through each word in an XML file and replaces them?
I don't have a bad sex life and I have the pictures to prove it.
-
Here is a link that will probably help you out:
http://www.w3schools.com/xml/xml_cdata.asp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|