View Single Post
Old 12-13-2012, 03:56 PM   PM User | #7
sinsysonline
New Coder

 
Join Date: Dec 2012
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
sinsysonline is an unknown quantity at this point
Greetings Andrew,

I appreciate all of the help. So here is a breakdown of how I have it as of now:

Code:
<span id="Body0"></span>
<span id="Body1"></span>
<span id="Body2"></span>
etc...

<script>
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.open("GET","secretlink=xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;

var i=0,d;
while (d=document.getElementById("Body"+i)) d.innerHTML=xmlDoc.getElementsByTagName("Body")[i++].childNodes[0].nodeValue;
</script>
And here is small sample of the XML file I'm pulling the data from:

Code:
<PostItems>
      <member>
        <Author>user:chayavic</Author>
        <Body>@joelboss just saved someone's Christmas. What have you done today? There's still time. #c2alerts</Body>
        <Topics>
          <member>hashtag:c2alerts</member>
          <member>user:joelboss</member>
        </Topics>
        <Created>2012-12-12T23:41:50.948Z</Created>
        <Votes>
          <DownVotes>0</DownVotes>
          <UpVotes>2</UpVotes>
          <UpVoters>
            <member>
              <Timestamp>2012-12-12T23:49:22.789Z</Timestamp>
              <Voter>user:snyderm</Voter>
            </member>
            <member>
              <Timestamp>2012-12-13T00:17:28.380Z</Timestamp>
              <Voter>user:amyschra</Voter>
            </member>
          </UpVoters>
        </Votes>
        <PostId>da3316a1-bdda-40c6-8429-5d694ca6ecd3</PostId>
      </member>
I don't know what exactly I'm doing wrong, but essentially I'm pulling "Body" Data with the code into an array, and somehow I need to pull the "Created" info (converted into format Tuesday, December 16th 8:55pm)

I've tried the code you suggested and been smashing my head against the wall trying to figure out what I'm doing wrong.


Oh, and for clarification, the code should essentially create the spans "Created0", "Created1", etc. It already extracts the Body data, which was pretty simple because I'm not editing it at all.

I wish I had a Live version to show you but everything on internal on the server here. You wouldn't have access unless you were on the VPN.
sinsysonline is offline   Reply With Quote