Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 





Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read

Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
Thread Tools
Old 11-26-2005, 08:18 PM   #1 (permalink)
Registered User
 
Join Date: Nov 2005
Posts: 4
OS: WinXP Pro


Confused XML Formatting - Easy Question

I'm new to XML and I'm trying to create a script that reads an ASP file that outputs as XML. The data inside uses the following format:
Code:
<ChatLog>
<line>
<time>11-26-05 5:34 PM</time>
<name>Bob</name>
<message>Hello Susan.</message>
</line>
<line>
<time>11-26-05 5:36 PM</time>
<name>Susan</name>
<message>Why, hello there.</message>
</line>
</ChatLog>
I know the format for the XML file is correct, I'm now trying to figure out how to have the file displayed in the following format:
Code:
<b>[ 'DATE' ] 'NAME':</b> 'MESSAGE'<br>
I need the script to update the XML data about 2 times per second using a similar code such as the following:
Code:
<script>
function refresh(){
setTimeout("refresh()", 500);
createXML();
}
</script>
I feel like I'm so close to the answer, I've tried using an XSL file and got it to format it correctly, but the javascript doesn't execute & refresh like it's supposed to. Is there anyone that could help me with this? I would *greatly* appreciate any/all help you could give. ^_^

Last edited by Frogger90 : 11-26-2005 at 08:20 PM.
Frogger90 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 11-27-2005, 10:56 PM   #2 (permalink)
Manager, On the Web
 
E-Liam's Avatar
 
Join Date: Jan 2004
Location: Bracknell, UK
Posts: 929
OS: XP


Hi,

Try using this string instead when opening the script.

Code:
<script type="text/javascript">
Cheers

Liam
__________________


My Mother suggested a family outing... so I told her Uncle Bob was gay. (Trevor D.)

Never argue with an idiot! They'll bring you down to their level and beat you with experience.

---------------------------------------------------------------------------------
A member of the Alliance of Security Analysis Professionals since 2004.
E-Liam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 11-28-2005, 02:05 PM   #3 (permalink)
Registered User
 
Join Date: Nov 2005
Posts: 4
OS: WinXP Pro


Okay, I tired that & revised my code a bit. It's working somewhat better, I think. However, it prints the lines 23 times, not sure why. Here are the links to the files, tell me what you think could be going wrong.

http://www.pcstudyguide.com/testxml.asp <--view the formatted xml file
http://www.pcstudyguide.com/testxml.asp?x=2 <--view the unformatted XML file
http://www.pcstudyguide.com/testxsl.xsl <--view the XSL file
http://www.pcstudyguide.com/testxml.asp?x=3 <--add a line of chat code to the XML file
http://www.pcstudyguide.com/testxml.asp?x=1 <--clears the chatlog, in case it gets too long just run this script

If you need to know any of the source for the files, just let me know. Thanks a lot for the help.
Frogger90 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 12-09-2005, 06:53 PM   #4 (permalink)
Registered User
 
Join Date: Nov 2005
Posts: 4
OS: WinXP Pro


*BUMP*
Please help, someone has to know the answer to this...
Frogger90 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 12-11-2005, 03:11 AM   #5 (permalink)
Manager, On the Web
 
E-Liam's Avatar
 
Join Date: Jan 2004
Location: Bracknell, UK
Posts: 929
OS: XP


Hi,

the only thing I can see that doesn't look correct is where you have " -" before several of the lines..

<?xml version="1.0" encoding="ISO-8859-1" ?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <html>
- <head>
<script type="text/javascript">function createXML(){ document.clear(); var xmlChat = new ActiveXObject("Microsoft.XMLDOM") xmlChat.async = "false" xmlChat.load("testxml.asp?x=2") var xsl = new ActiveXObject("Microsoft.XMLDOM") xsl.async = "false" xsl.load("testxsl.xsl") document.write(xmlChat.transformNode(xsl)) setTimeout("createXML()", 1000); } createXML();</script>
</head>
- <body>
- <xsl:for-each select="ChatLog/line">
- <b>
[
<xsl:value-of select="time" />
]
<xsl:value-of select="name" />
:
</b>
<xsl:value-of select="message" />
<br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

When attempting to validate the code, w3c's validator doesn't like them.

Try that. Perhaps that's stopping the code from being formatted correctly.

Cheers

Liam
__________________


My Mother suggested a family outing... so I told her Uncle Bob was gay. (Trevor D.)

Never argue with an idiot! They'll bring you down to their level and beat you with experience.

---------------------------------------------------------------------------------
A member of the Alliance of Security Analysis Professionals since 2004.
E-Liam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Old 01-13-2006, 11:45 AM   #6 (permalink)
Registered User
 
Join Date: Nov 2005
Posts: 4
OS: WinXP Pro


No, I validated each file on it's own and found no errors. Any other suggestions, anyone? This seems to be a real noggin scratcher. hehe
Frogger90 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Bookmark on Thread SoupReddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -7. The time now is 04:27 PM.



Copyright 2001 - 2008, Tech Support Forum

Search Engine Friendly URLs by vBSEO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82