Permalink
Browse files

The recent articles table displayed an error off of one users table s…

…tructure, the problem arrived because even though in all other cases I checked the table produced the proper output, in this particular users case, the yql query return's structure was uniquely different. so, I added basic conditionals to test throughout the structure of the yql query before I attached content from it to my xml structure.

I did the same for all the tables in the YVoices family
  • Loading branch information...
1 parent 13e6c41 commit c7522c28cd7618927c966f1744f9dfcccf01b93a @houyhnhnm committed Mar 15, 2012
View
@@ -37,6 +37,8 @@
}
while(index<yqlcounter2)
{
+ if((yqlresults.div)&&(yqlresults.div.a[index].img))
+ {
subregex=yqlresults.div.a[index].@href;
subregex2=new String(subregex.match(patt1));
subregex3=new String(subregex2.match(patt2));
@@ -48,6 +50,7 @@
</node>
index++;
}
+ }
response.object=xmlret;
]]>
</execute>
@@ -29,6 +29,8 @@
}
while(index<yqlcounter2)
{
+ if((yqlresults.div)&&(yqlresults.div.a[index].img))
+ {
xmlret.root+=<node>
<title>{yqlresults.div.a[index].@title}</title>
<description>{yqlresults.div.a[index].@title}</description>
@@ -37,6 +39,7 @@
</node>
index++;
}
+ }
response.object=xmlret;
]]>
</execute>
@@ -26,21 +26,27 @@
{
if(yqlresults.div[index].span.length()>0)
{
+ if((yqlresults.div[index].a)&&(yqlresults.div[index].div)&&(yqlresults.div[index].div.img))
+ {
xmlret.root+=<node>
<title>{yqlresults.div[index].span[0].text()}</title>
<description>{yqlresults.div[index].span[1].text()}</description>
<link>{yqlresults.div[index].a.@href}</link>
<thumbnail>{yqlresults.div[index].div.img.@src}</thumbnail>
</node>
}
+ }
else
{
+ if((yqlresults.div[index].a)&&(yqlresults.div[index].a.span[0])&&(yqlresults.div[index].a.span[1]))
+ {
xmlret.root+=<node>
<title>{yqlresults.div[index].a.span[0].text()}</title>
<description>{yqlresults.div[index].a.span[1].text()}</description>
<link>{yqlresults.div[index].a.@href}</link>
</node>
}
+ }
index++;
}
response.object=xmlret;
@@ -26,6 +26,8 @@
{
if(parseInt(yqlresults.li[index].div.length())>1)
{
+ if((yqlresults.li[index].div[1].div[0])&&(yqlresults.li[index].div[1].div[1])&&(yqlresults.li[index].div[1].a)&&(yqlresults.li[index].div[1].div[1])&&(yqlresults.li[index].div[1].a.@href)&&(yqlresults.li[index].div[1].div[0].p)&&(yqlresults.li[index].div[0].img.@src))
+ {
xmlret.root+=<node>
<title>{yqlresults.li[index].div[1].a.text()}</title>
<description>{yqlresults.li[index].div[1].div[1]}</description>
@@ -34,15 +36,19 @@
<thumbnail>{yqlresults.li[index].div[0].img.@src}</thumbnail>
</node>
}
+ }
else
{
+ if((yqlresults.li[index].div.div[0])&&(yqlresults.li[index].div.div[1])&&(yqlresults.li[index].div.a)&&(yqlresults.li[index].div.div[1].p)&&(yqlresults.li[index].div.a.@href)&&(yqlresults.li[index].div.div[0].p))
+ {
xmlret.root+=<node>
<title>{yqlresults.li[index].div.a.text()}</title>
<description>{yqlresults.li[index].div.div[1].p.text()}</description>
<link>{yqlresults.li[index].div.a.@href}</link>
<pubdate>{yqlresults.li[index].div.div[0].p.text()}</pubdate>
</node>
}
+ }
index++;
}
response.object=xmlret;
@@ -24,6 +24,8 @@
xmlret=<root><count>{yqlcounter}</count></root>;
while(index<yqlcounter)
{
+ if((yqlresults.li[index].cite)&&(yqlresults.li[index].cite.span)&&(yqlresults.li[index].p))
+ {
xmlret.root+=<node>
<title>{yqlresults.li[index].cite.span.text()}</title>
<description>{yqlresults.li[index].p.text()}</description>
@@ -32,6 +34,7 @@
</node>
index++;
}
+ }
response.object=xmlret;
]]>
</execute>

0 comments on commit c7522c2

Please sign in to comment.