|
|
Question : Issuie Identifying XML feed issue
|
|
|
|
Help.... Please
When I try testing the following feed http://jobsonlinegroup.com/feeds/mnm/careerjet_organic.asp I get the following error - xxx
The feed is created using ASP , the code is below -
There is a lot of data produced by the feed, so I can't see what is causing the issue .....
Please help...
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:
83:
|
<%@LANGUAGE="VBSCRIPT"%><?xml version="1.0" encoding="ISO-8859-1"?>
<% Response.Buffer = true
Response.ContentType = "text/xml"
Function ApplyXMLFormatting(strInput)
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", """)
strInput = Replace(strInput, ">", ">")
strInput = Replace(strInput,"<","<")
strInput = Replace(strInput,"&amp;", "&")
strInput = Replace(strInput,"&#163;","£")
strInput = Replace(strInput, "&#160;", "")
strInput = Replace(strInput, "sex", "")
strInput = Replace(strInput, "p>", "")
strInput = Replace(strInput, "<", "")
strInput = Replace(strInput, "&nbsp;", "")
strInput = Replace(strInput, "&#8230;", "")
strInput = Replace(strInput, "p&gt;&lt;", "")
strInput = Replace(strInput, " ", "")
strInput = Replace(strInput, "b&gt;", "")
strInput = Replace(strInput, "bull", "")
ApplyXMLFormatting = strInput
End Function
%>
<!--#include file="../../Connections/recruta2.asp" -->
<!--#include file="../../Connections/removeutfformatting.asp" -->
<%
Dim searchresults
Dim searchresults_cmd
Dim searchresults_numRows
Set searchresults_cmd = Server.CreateObject ("ADODB.Command")
searchresults_cmd.ActiveConnection = MM_recruta2_STRING
searchresults_cmd.CommandText = "SELECT A.JBAID, A.JBATitle, A.JBALocation, A.JBACategory, A.JBAPayRate, A.JBADescription, A.JBAEmplymentType, A.JBAFeaturedJob, CONVERT(CHAR(11),A.JBADatePosted,106) AS JBADatePosted, C.JBCLName, S.JBSURL, S.JBSURLShort, S.JBSRegion FROM dbo.JBAdvert A inner join dbo.JBClient C on A.JBAClientID = C.JBCLID inner join dbo.JBSite S on A.JBASiteID = S.JBSSiteID WHERE JBSSIteOwnerID <> 3 AND JBADatePosted >= DATEADD(d,-JBAPostFor,GETDATE()) AND JBAFeaturedJob <> 'y' ORDER BY JBSURL,JBAID DESC"
searchresults_cmd.Prepared = true
Set searchresults = searchresults_cmd.Execute
searchresults_numRows = 0
%>
<source>
<publisher></publisher>
<publisherurl></publisherurl>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
searchresults_numRows = searchresults_numRows + Repeat1__numRows
%>
<%
While ((Repeat1__numRows <> 0) AND (NOT searchresults.EOF))
%>
<job>
<source><%=(searchresults.Fields.Item("JBSURLShort").Value)%></source>
<title><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBATitle").Value)%> - <%=ApplyXMLFormatting(searchresults.Fields.Item("JBAPayRate").Value)%> - <%=ApplyXMLFormatting(searchresults.Fields.Item("JBALocation").Value)%>]]></title>
<date><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBADatePosted").Value)%>]]></date>
<referencenumber><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBAID").Value)%>]]></referencenumber>
<url><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBSURL").Value)%>/detail~ID~<%=(searchresults.Fields.Item("JBAID").Value)%>~<%=Server.URLEncode(searchresults.Fields.Item("JBACategory").Value)%>-jobs-<%=Server.URLEncode(removeutfcharacters(searchresults.Fields.Item("JBATitle").Value))%>-jobs-in-<%=Server.URLEncode(searchresults.Fields.Item("JBALocation").Value)%>-<%=Server.URLEncode(searchresults.Fields.Item("JBCLName").Value)%>-jobs-in-<%=ApplyXMLFormatting(searchresults.Fields.Item("JBSRegion").Value)%>.htm]]></url>
<company><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBCLName").Value)%>]]></company>
<city><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBALocation").Value)%>]]></city>
<country><![CDATA[UK]]></country>
<description><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBADescription").Value)%>]]></description>
<salary><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBAPayRate").Value)%>]]></salary>
<jobtype><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBAEmplymentType").Value)%>]]></jobtype>
<category><![CDATA[<%=ApplyXMLFormatting(searchresults.Fields.Item("JBACategory").Value)%>]]></category>
</job>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
searchresults.MoveNext()
if Repeat1__numRows mod 10 = 0 then
Response.Flush()
end if
Wend
%>
</source>
<%
searchresults.Close()
Set searchresults = Nothing
%>
|
|
|
|
|
Answer : Issuie Identifying XML feed issue
|
|
I am getting an XML file as produced in FireFox. The only real issue that I can see is speed.... it is real slow...
this attributes to your coding preferences. IMHO, stop using built-in coding wizards (like the one in Dreamweaver), and learn to hand code... you will be better off...
Couple of tips.... don't jump in and out of code like that, make the page slow., Use .GetRows instead of trying to loop through the recordset... releases the connection earlier, thus speeding up the page.
Thus said, try the attached.
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:
|
<!--#include file="../../Connections/recruta2.asp" -->
<!--#include file="../../Connections/removeutfformatting.asp" -->
<%
Dim objConn, objRs, strQuery, arrRet, i
strQuery = "SELECT A.JBAID, A.JBATitle, A.JBALocation, A.JBACategory, " & _
"A.JBAPayRate, A.JBADescription, A.JBAEmplymentType, A.JBAFeaturedJob, " & _
"CONVERT(CHAR(11),A.JBADatePosted,106) AS JBADatePosted, C.JBCLName, S.JBSURL, " & _
"S.JBSURLShort, S.JBSRegion FROM dbo.JBAdvert A inner join dbo.JBClient C on " & _
"A.JBAClientID = C.JBCLID inner join dbo.JBSite S on A.JBASiteID = S.JBSSiteID " & _
"WHERE JBSSIteOwnerID <> 3 AND JBADatePosted >= DATEADD(d,-JBAPostFor,GETDATE()) " & _
"AND JBAFeaturedJob <> 'y' ORDER BY JBSURL,JBAID DESC"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open MM_recruta2_STRING 'Set our connection to the DB
Set objRs = objConn.Execute(strQuery) 'Execute our query
If Not(objRs.Eof) Then 'Check to see if there are records returned
arrRet = objRs.GetRows() 'Get the results into a 2-dimensional array
Else
Response.Write("There are no results.")
End If
Set objRs = Nothing 'Clean Up
objConn.Close() 'Clean Up
Set objConn = Nothing 'Clean Up
If IsArray(arrRet) Then 'Double check to see if we have a resultset
With Response
.Write("<?xml version=""1.0"" encoding=""ISO-8859-1""?>" & VbCrLf)
.Write("<sources>" & VbCrLf)
.Write(" <publisher></publisher> " & VbCrLf)
.Write(" <publisherurl></publisherurl>" & VbCrLf)
For i = 0 To UBound(arrRet, 2) '2 = Rows... arrRet(columns, rows) 0 based
.Write(" <job>" & VbCrLf)
.Write(" <source>" & arrRet(11, i) & "</source>" & VbCrLf)
.Write(" <title>" & ApplyXMLFormatting(arrRet(1, i)) & " - " & ApplyXMLFormatting(arrRet(4, i)) & " - " & ApplyXMLFormatting(arrRet(2, i)) & "</title>" & VbCrLf)
.Write(" <date>" & ApplyXMLFormatting(arrRet(8, i)) & "</date>" & VbCrLf)
.Write(" <referencenumber>" & ApplyXMLFormatting(arrRet(0, i)) & "</referencenumber>" & VbCrLf)
.Write(" <url>" & ApplyXMLFormatting(arrRet(10, i)) & "/detail~ID~" & arrRet(0, i) & "~" & Server.URLEncode(arrRet(3, i)) & "-jobs-" & Server.URLEncode(removeutfcharacters(arrRet(1, i))) & "-jobs-in-" & Server.URLEncode(arrRet(2, i)) & "-" & Server.URLEncode(arrRet(9, i)) & "-jobs-in-" & ApplyXMLFormatting(arrRet(12, i)) & ".htm</url>" & VbCrLf)
.Write(" <company>" & ApplyXMLFormatting(arrRet(9, i)) & "</company>" & VbCrLf)
.Write(" <city>" & ApplyXMLFormatting(arrRet(2, i)) & "</city>" & VbCrLf)
.Write(" <country>UK</country>" & VbCrLf)
.Write(" <description>" & ApplyXMLFormatting(arrRet(5, i)) & "</description>" & VbCrLf)
.Write(" <salary>" & ApplyXMLFormatting(arrRet(4, i)) & "</salary>" & VbCrLf)
.Write(" <jobtype>" & ApplyXMLFormatting(arrRet(6, i)) & "</jobtype>" & VbCrLf)
.Write(" <category>" & ApplyXMLFormatting(arrRet(3, i)) & "</category>" & VbCrLf)
.Write(" </job>" & VbCrLf)
If i Mod 25 Then Response.Flush
Next : i = Null
.Write("</sources>" & VbCrLf)
End With
Erase arrRet 'Release the array from memory
Else
Response.Write("There are no results.")
End If
Function ApplyXMLFormatting(strInput)
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", """)
strInput = Replace(strInput, ">", ">")
strInput = Replace(strInput,"<","<")
strInput = Replace(strInput,"&amp;", "&")
strInput = Replace(strInput,"&#163;","£")
strInput = Replace(strInput, "&#160;", "")
strInput = Replace(strInput, "sex", "")
strInput = Replace(strInput, "p>", "")
strInput = Replace(strInput, "<", "")
strInput = Replace(strInput, "&nbsp;", "")
strInput = Replace(strInput, "&#8230;", "")
strInput = Replace(strInput, "p&gt;&lt;", "")
strInput = Replace(strInput, " ", "")
strInput = Replace(strInput, "b&gt;", "")
strInput = Replace(strInput, "bull", "")
ApplyXMLFormatting = strInput
End Function
%>
|
|
|
|
|