Forum Moderators: open

Message Too Old, No Replies

XML & Javascript

XML & Javascript

         

trevordixon

7:55 am on Jan 16, 2006 (gmt 0)

10+ Year Member



I'm extremely new to XML, tell me what needs to be fixed in my XML file as well as in my javascript.

My XML file looks like this:

<?xml version="1.0" encoding="iso-8859-1"?>

<imapmail>
<message>
<subject>Testing, 123</subject>
<sender>Name &lt;email&#64;example.com&gt;</sender>
<date>1/2/03</date>
<size>640 KB</size>
<read>0</read>
</message>
</imapmail>

I'm accessing it with this javascript:

var sender =
xmlDocument.getElementsByTagName("sender").item(0).firstChild.data;

I ultimately want to user to see that the sender is "Name <email@example.com>". With the way the XML file is currently set up (sender is Name &lt;email&#64;example.com&gt;), the only that shows up on the javascript end is Name. Is the way I'm storing it in my XML file the best way to be doing it?

Thanks for your help,
Trevor

johnl

1:17 am on Jan 17, 2006 (gmt 0)

10+ Year Member



hi,

at least on my computer using ie6.0 sp1 this works as you expect.

its hard to tell what might go wrong on your side without seeing the actual javascript. you might run into difficulties though, because '&lt;' could be interpreted as '<' - the start of a new element of the xmldoc.