[asp] XML pagina wordt niet als XML weergegeven :?

Pagina: 1
Acties:

  • Woudloper
  • Registratie: November 2001
  • Niet online

Woudloper

« - _ - »

Topicstarter
Ik zit met het volgende probleem...

Ik wil voor HotTopic een Active Topics in XML maken.... Zoals je kan zien het het topic is het mij reeds gelukt...
PHP:
1
<?<!--#INCLUDE FILE="config.asp" --><%dim fso, bestand, refreshtijd, xfiledim my_ConnResponse.ContentType = "text/xml"set my_Conn = Server.CreateObject("ADODB.Connection")my_Conn.Open strConnString    bestand         = "cache.xml"    refreshtijd     = 15    Set fso = Server.CreateObject("Scripting.FileSystemObject")    if fso.FileExists(Server.MapPath(bestand)) Then      dim leeftijd, fo      set fo = fso.getFile(Server.MapPath(bestand))      leeftijd = datediff("s",fo.DateLastModified, now())      if(leeftijd < refreshtijd) then            set fo = fo.OpenAsTextStream                response.write(fo.readall)            response.end      end if    end if    strSQL = "SELECT T.TOPIC_ID, "                &amp; _            "T.T_SUBJECT, "                &amp; _            "T.FORUM_ID, "                &amp; _            "F.F_ABBREVIATION, "            &amp; _            "T.T_DATE, "                &amp; _            "T.T_LAST_POST, "            &amp; _            "M.M_NAME, "                &amp; _            "T.T_AUTHOR, "                &amp; _            "T.T_REPLIES, "                &amp; _            "M1.M_NAME AS REPLIER, "        &amp; _            "T.T_LAST_POST_AUTHOR "            &amp; _        "FROM     MEMBERS AS M, "                &amp; _        "    TOPICS AS T, "                &amp; _        "    FORUM AS F, "                &amp; _        "    MEMBERS AS M1 "                &amp; _        "WHERE     T.T_LAST_POST_AUTHOR = M1.MEMBER_ID "    &amp; _        "    AND T.FORUM_ID = F.FORUM_ID "        &amp; _        "    AND M.MEMBER_ID = T.T_AUTHOR "        &amp; _        "ORDER BY T.T_LAST_POST DESC;"    Set rs = Server.CreateObject("ADODB.Recordset")    rs.open strSQL, my_Conn        xfile = "<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>" &amp; vbNewline &amp; _                 "<activetopics>" &amp; vbNewline    Do While NOT rs.EOF                                 xfile = xfile &amp; "<topic>" &amp; vbNewline                             &amp; _            "        <id>" &amp; rs("TOPIC_ID") &amp; "</id>" &amp; vbNewline                &amp; _                        "        <titel>" &amp; rs("T_SUBJECT") &amp; "</titel>" &amp; vbNewline             &amp; _                       "        <forum>" &amp; rs("FORUM_ID") &amp; "</forum>" &amp; vbNewline                 &amp; _                       "        <forumafkorting>" &amp; RS("F_ABBREVIATION") &amp; "</forumafkorting>" &amp; vbNewline     &amp; _                        "        <startts>" &amp; rs("T_DATE") &amp; "</startts>" &amp; vbNewline             &amp; _                       "        <lastts>" &amp; rs("T_LAST_POST") &amp; "</lastts>" &amp; vbNewline             &amp; _                       "        <topicstarter>" &amp; rs("M_NAME") &amp; "</topicstarter>" &amp; vbNewline         &amp; _                       "        <starterid>" &amp; rs("T_AUTHOR") &amp; "</starterid>" &amp; vbNewline             &amp; _                       "        <replies>" &amp; rs("T_REPLIES") &amp; "</replies>" &amp; vbNewline             &amp; _                       "        <last_replier>" &amp; rs("REPLIER") &amp; "</last_replier>" &amp; vbNewline         &amp; _                       "        <replierid>" &amp; rs("T_LAST_POST_AUTHOR") &amp; "</replierid>" &amp; vbNewline     &amp; _                       "        <messageid>" &amp; rs("TOPIC_ID") &amp; "</messageid>" &amp; vbNewline             &amp; _                       "</topic>" &amp; vbNewline         rs.movenext    loop    rs.close    set rs = nothing  xfile = xfile &amp; "    <fileinfo>" &amp; vbNewline  xfile = xfile &amp; "        <timestamp>"&amp; now() &amp; "</timestamp>"  &amp; vbNewline  xfile = xfile &amp; "        <info>build 162, (Copyright Woudloper)</info>" &amp; vbNewline  xfile = xfile &amp; "    </fileinfo>" &amp; vbNewline  xfile = xfile &amp; "</activetopics>" &amp; vbNewline  set file_open = fso.CreateTextFile(Server.MapPath(bestand))  file_open.write(xfile)  file_open.close  set file_open = Nothing  set fso = nothing  response.write xfile  my_Conn.Close  set my_Conn = nothing %> ?>

Er is echter een klein probleem.

Als ik nu gewoon de pagina opvraag, krijg ik alleen de inhoud van de tags te zien, maar niet de XML pagina als zodanig...

zie:
4 fe 1 20020403191330 20020403191330 Admin 1 0 Admin 1 4 3 dfasdfasdf 1 20020403190418 20020403190418 Admin 1 0 Admin 1 3 2 [Discussion] How do you find the forum? 1 20020329072313 20020403190123 Admin 1 2 Admin 1 2 1 Welcome to Snitz Forums 2000 1 20010725010000 20010725010000 Admin 1 0 Admin 1 1 5/2/2002 5:14:11 PM build 162, (Copyright Woudloper)
Het vreemde is als ik het cache.xml opvraag het wel gewoon goed gaat :?
code:
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
<?xml version="1.0" encoding="ISO-8859-1" ?> 
- <activetopics>
- <topic>
  <id>4</id> 
  <titel>fe</titel> 
  <forum>1</forum> 
  <forumafkorting /> 
  <startts>20020403191330</startts> 
  <lastts>20020403191330</lastts> 
  <topicstarter>Admin</topicstarter> 
  <starterid>1</starterid> 
  <replies>0</replies> 
  <last_replier>Admin</last_replier> 
  <replierid>1</replierid> 
  <messageid>4</messageid> 
  </topic>
- <topic>
  <id>3</id> 
  <titel>dfasdfasdf</titel> 
  <forum>1</forum> 
  <forumafkorting /> 
  <startts>20020403190418</startts> 
  <lastts>20020403190418</lastts> 
  <topicstarter>Admin</topicstarter> 
  <starterid>1</starterid> 
  <replies>0</replies> 
  <last_replier>Admin</last_replier> 
  <replierid>1</replierid> 
  <messageid>3</messageid> 
  </topic>
- <topic>
  <id>2</id> 
  <titel>[Discussion] How do you find the forum?</titel> 
  <forum>1</forum> 
  <forumafkorting /> 
  <startts>20020329072313</startts> 
  <lastts>20020403190123</lastts> 
  <topicstarter>Admin</topicstarter> 
  <starterid>1</starterid> 
  <replies>2</replies> 
  <last_replier>Admin</last_replier> 
  <replierid>1</replierid> 
  <messageid>2</messageid> 
  </topic>
- <topic>
  <id>1</id> 
  <titel>Welcome to Snitz Forums 2000</titel> 
  <forum>1</forum> 
  <forumafkorting /> 
  <startts>20010725010000</startts> 
  <lastts>20010725010000</lastts> 
  <topicstarter>Admin</topicstarter> 
  <starterid>1</starterid> 
  <replies>0</replies> 
  <last_replier>Admin</last_replier> 
  <replierid>1</replierid> 
  <messageid>1</messageid> 
  </topic>
- <fileinfo>
  <timestamp>5/2/2002 5:14:11 PM</timestamp> 
  <info>build 162, (Copyright Woudloper)</info> 
  </fileinfo>
  </activetopics>

Weet iemand wat ik fout doe of wat ik eraan moet doen om het wel op de juiste manier weergegeven te krijgen...

[ Voor 0% gewijzigd door Woudloper op 09-04-2015 13:51 . Reden: naamaanpassing ]


  • djc
  • Registratie: December 2001
  • Laatst online: 08-09-2025

djc

Kopieer de URL uit je adresbalk, ga naar een andere site (maakt niet uit wat) en plak de URL weer in je adresbalk. Hit enter en waarschijnlijk zie je de source nu wel goed.

Rustacean


Verwijderd

Waarom bouw je je XML op als string en niet als DOM object :? Lijkt me ietsje netter :).

Zet je responsetype anders 's uit, en kijk of je gewoon nette XML op je scherm krijgt (als tekst dan)...

  • Woudloper
  • Registratie: November 2001
  • Niet online

Woudloper

« - _ - »

Topicstarter
Manuzhai:
Kopieer de URL uit je adresbalk, ga naar een andere site (maakt niet uit wat) en plak de URL weer in je adresbalk. Hit enter en waarschijnlijk zie je de source nu wel goed.
Het werkt!! Zal wel iets met een caching geweest zijn :? Vreemd hoor...
KoenM:
Waarom bouw je je XML op als string en niet als DOM object :? Lijkt me ietsje netter :).
Dit was even iets gemakkelijker en ik had geen zin om de code een stukje langer te maken...

Zelf denk ik dat deze oplossing ook nog sneller is, maar dat moet ik dan eerst even gaan checken...

  • djc
  • Registratie: December 2001
  • Laatst online: 08-09-2025

djc

Op vrijdag 03 mei 2002 09:10 schreef Woudloper het volgende:
Het werkt!! Zal wel iets met een caching geweest zijn :? Vreemd hoor...
De caching van IE wat dit betreft is nogal k*t.

Rustacean