blank output while running script

0 views
Skip to first unread message

sweta

unread,
Oct 20, 2009, 4:33:03 AM10/20/09
to Open Mashup Alliance Interest Group
hi,

below is the script and related intermediate xml result which invokes
the endpoint "http://www.cnn.com/" and from the meta information in
resulting xml
specifically from tag given below
<link href="http://rss.cnn.com/rss/cnn_latest.rss"
title="CNN - Recent Stories [RSS]" type="application/rss+xml"
rel="alternate"/> i am trying to match type of this link tag with
"application/rss+xml".

but when i am running this script nothing is the output.. it gives me
blank output in the browser and also while running it with emmlclient
on the console.

one more thing is.. when i m invoking just directinvoke tag without
filter then in the browser with view source i m not getting full xml
result, but with the emmlclient i m getting the full xml response. so
can that be the source of error?


MY SCRIPT

<mashup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openemml.org/2009-04-15/
EMMLSchema ../schemas/EMMLSpec.xsd"
xmlns="http://www.openemml.org/2009-04-15/EMMLSchema"
name="FeedAutoDiscovery">
<output name="result" type="document"/>
<variables>
<variable name="temp" type="document"/>
<variable name="var1" type="string" default="application/rss+xml"/>
<variable name="temp2" type="document"/>
</variables>
<directinvoke endpoint="http://www.cnn.com/" onerror="continue"
outputvariable="temp"/>
<display message="the temp2 variable=" expr="$temp/html/head[link
[@type=$var1]]"/>
<filter inputvariable="$temp" filterexpr="/html/head[link[@type=
$var1]]" outputvariable="result"/>

</mashup>



INTERMEDIATE XML RESPONSE

xml after invoking the endpoint "http://www.cnn.com/"
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta content="HTML Tidy, see www.w3.org" name="generator"/>
<title>CNN.com - Breaking News, U.S., World, Weather,
Entertainment &amp; Video News</title>
<meta content="1800;url=?refresh=1" http-equiv="refresh"/>
<meta
content="CNN.com delivers the latest breaking news and
information on the latest top stories, weather, business,
entertainment, politics, and more. For in-depth coverage, CNN.com
provides special reports, video, audio, photo galleries, and
interactive guides." name="Description"/>
<meta
content="CNN, CNN news, CNN.com, CNN TV, news, news online,
breaking news, U.S. news, world news, weather, business, CNN Money,
sports, politics, law, technology, entertainment, education, travel,
health, special reports, autos, developing story, news video, CNN
Intl" name="Keywords"/>
<link href="http://rss.cnn.com/rss/cnn_topstories.rss"
title="CNN - Top Stories [RSS]" type="application/rss+xml"
rel="alternate"/>
<link href="http://rss.cnn.com/rss/cnn_latest.rss"
title="CNN - Recent Stories [RSS]" type="application/rss+xml"
rel="alternate"/>
<meta content="text/html; charset=iso-8859-1" http-equiv="content-
type"/>
<link href="http://i.cdn.turner.com/cnn/.element/css/2.0/
common.css"
type="text/css" rel="stylesheet"/>
<link href="http://i.cdn.turner.com/cnn/.element/css/2.0/main.css"
type="text/css" rel="stylesheet"/>
<script type="text/javascript"> if(window.top!=window.self)
{
if(document.cookie.indexOf('rfrshchck=')!=-1)
{
window.top.location=window.self.location;
}
document.cookie='rfrshchck=1';
}
</script>
<script type="text/javascript" src="http://i.cdn.turner.com/
cnn/.element/js/2.0/scripts/prototype.js"/>
<script type="text/javascript" src="http://i.cdn.turner.com/
cnn/.element/js/2.0/scripts/scriptaculous.js?load=effects"/>
<script type="text/javascript" src="http://i.cdn.turner.com/
cnn/.element/js/2.0/csiManager.js"/>
<script type="text/javascript" src="http://i.cdn.turner.com/
cnn/.element/js/2.0/StorageManager.js"/>
<script type="text/javascript" src="http://i.cdn.turner.com/
cnn/.element/js/2.0/local.js"/>
<script type="text/javascript" src="http://i.cdn.turner.com/
cnn/.element/js/2.0/main.js"/>
<link href="http://i.cdn.turner.com/cnn/apple-touch-icon.png"
rel="apple-touch-icon"/>
<link title="CNN.com" href="/tools/search/cnncom.xml"
type="application/opensearchdescription+xml" rel="search"/>
<link title="CNN.com Video" href="/tools/search/cnncomvideo.xml"
type="application/opensearchdescription+xml" rel="search"/>
<script language="javascript" type="text/
javascript">pagetypeTS='homepage';

var overrideVideoAd = '/cnn_adspaces/2.0/homepage/
video.postroll_emb.ad';
</script>

.
.
.

raj

unread,
Oct 21, 2009, 7:17:31 PM10/21/09
to open-mashu...@googlegroups.com
Sweta,

1. You need to account for namespace in xpath expression.  Or you can qualify with * namespace prefix for anonymous namespace mappings.

2. Assign statement would be more appropriate, since i assume u want only those links.

3. From the mashup script, only document structures can be returned (i.e. no node-sets). Hence, need to wrap it with a <constructor/>.


I just tweaked your sample as follows :

       xsi:schemaLocation="http://www.openemml.org/2009-04-15/
EMMLSchema ../schemas/EMMLSpec.xsd"
 name="FeedAutoDiscovery">
                <output name="result" type="document"/>
                <variables>
                 <variable name="temp" type="document"/>
                <variable name="var1" type="string" default="application/rss+xml"/>
                <variable name="temp2" type="document"/>
                </variables>
               <directinvoke endpoint="http://www.cnn.com/" onerror="continue" outputvariable="temp"/>

               
               <assign fromexpr="$temp//*:link[@type = 'application/rss+xml']" outputvariable="result"/>    

               <constructor outputvariable="result"> 
                <mylinks>
                    {$temp//*:link[@type = 'application/rss+xml']}
                </mylinks> 
               </constructor>
                    
</mashup>       

Running it, u should see the following output:

raj-2:bin rajk$ java emmlclient "http://localhost:8090/emml/oma1"
<?xml version="1.0" encoding="UTF-8"?>
<mylinks>
  <link href="http://rss.cnn.com/rss/cnn_topstories.rss" rel="alternate"
    title="CNN - Top Stories [RSS]" type="application/rss+xml" xmlns="http://www.w3.org/1999/xhtml"/>
  <link href="http://rss.cnn.com/rss/cnn_latest.rss" rel="alternate"
    title="CNN - Recent Stories [RSS]" type="application/rss+xml" xmlns="http://www.w3.org/1999/xhtml"/>
</mylinks>

hth,
raj

raj

unread,
Oct 21, 2009, 7:19:49 PM10/21/09
to open-mashu...@googlegroups.com
Please ignore the previous script....    here is the actual one.



       xsi:schemaLocation="http://www.openemml.org/2009-04-15/
EMMLSchema ../schemas/EMMLSpec.xsd"
 name="FeedAutoDiscovery">
                <output name="result" type="document"/>
                <variables>
                 <variable name="temp" type="document"/>
                <variable name="var1" type="string" default="application/rss+xml"/>
                <variable name="temp2" type="document"/>
                </variables>
               <directinvoke endpoint="http://www.cnn.com/" onerror="continue" outputvariable="temp"/>

               
               <assign fromexpr="$temp//*:link[@type = 'application/rss+xml']" outputvariable="result"/>    

               <constructor outputvariable="result"> 
                <mylinks>
                    {$result}
                </mylinks> 
               </constructor>
                    
</mashup>       

sweta

unread,
Oct 26, 2009, 6:58:33 AM10/26/09
to Open Mashup Alliance Interest Group
Thanks for responding. It actually worked.

Sweta.
> >>    <meta content="HTML Tidy, seewww.w3.org" name="generator"/>
> >> cnn/.element/js/2.0/scripts/prototype.js<http://i.cdn.turner.com/cnn/.element/js/2.0/scripts/prototype.js>
> >> "/>
> >>    <script type="text/javascript" src="http://i.cdn.turner.com/
> >> cnn/.element/js/2.0/scripts/scriptaculous.js?load=effects<http://i.cdn.turner.com/cnn/.element/js/2.0/scripts/scriptaculous.js?...>
> >> "/>
> >>    <script type="text/javascript" src="http://i.cdn.turner.com/
> >> cnn/.element/js/2.0/csiManager.js<http://i.cdn.turner.com/cnn/.element/js/2.0/csiManager.js>
> >> "/>
> >>    <script type="text/javascript" src="http://i.cdn.turner.com/
> >> cnn/.element/js/2.0/StorageManager.js<http://i.cdn.turner.com/cnn/.element/js/2.0/StorageManager.js>
> >> "/>
> >>    <script type="text/javascript" src="http://i.cdn.turner.com/
> >> cnn/.element/js/2.0/local.js<http://i.cdn.turner.com/cnn/.element/js/2.0/local.js>
> >> "/>
> >>    <script type="text/javascript" src="http://i.cdn.turner.com/
> >> cnn/.element/js/2.0/main.js<http://i.cdn.turner.com/cnn/.element/js/2.0/main.js>
> >> "/>
> >>    <link href="http://i.cdn.turner.com/cnn/apple-touch-icon.png"
> >> rel="apple-touch-icon"/>
> >>    <link title="CNN.com" href="/tools/search/cnncom.xml"
> >>      type="application/opensearchdescription+xml" rel="search"/>
> >>    <link title="CNN.com Video" href="/tools/search/cnncomvideo.xml"
> >>      type="application/opensearchdescription+xml" rel="search"/>
> >>    <script language="javascript" type="text/
> >> javascript">pagetypeTS='homepage';
>
> >> var overrideVideoAd = '/cnn_adspaces/2.0/homepage/
> >> video.postroll_emb.ad';
> >> </script>
>
> >> .
> >> .
> >> .- Hide quoted text -
>
> - Show quoted text -

sweta

unread,
Nov 5, 2009, 1:17:37 AM11/5/09
to Open Mashup Alliance Interest Group
That sample actually worked. but can u please explain me that why we
used assign? i wanted only those links.. this was possible with the
way i already did it with the match function of the XPath expression.

Sara Mitchell

unread,
Nov 5, 2009, 12:57:45 PM11/5/09
to open-mashu...@googlegroups.com
Mashup results must be well-formed XML or you get no output. So the result must be wrapped in a root node.

The <constructor> statement from the working sample does exactly that -- it wraps the list of links from your <assign> statement with a <mylinks> node. What you wanted (just a list of <link> nodes) is called a node-set (or in XPath 2.0 wording a sequence) and is not a valid result for a mashup.

--- On Wed, 11/4/09, sweta <desai...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages