Hear is XML. I am trying to get Number of titles published by an author in a date range 15/02/2012 to 24/02/2012 order by highest to lowest (number of titles).
<entries>
<entry>
<id>1</id>
<published>23/02/2012</published>
<title>Title 1</title>
<content type="html">This is title one</content>
<author>
<name>Pankaj</name>
</author>
</entry>
<entry>
<id>2</id>
<published>22/02/2012</published>
<title>Title 2</title>
<content type="html">This is title two</content>
<author>
<name>Pankaj</name>
</author>
</entry>
<entry>
<id>3</id>
<published>21/02/2012</published>
<title>Title 3</title>
<content type="html">This is title three</content>
<author>
<name>Rob</name>
</author>
</entry>
<entry>
<id>4</id>
<published>20/02/2012</published>
<title>Title 4</title>
<content type="html">This is title four</content>
<author>
<name>Bob</name>
</author>
</entry>
<entry>
<id>5</id>
<published>19/02/2012</published>
<title>Title 1</title>
<content type="html">This is title five</content>
<author>
<name>Pankaj</name>
</author>
</entry>
I am trying to get output from xquery:
<?xml version="1.0" encoding="UTF-8"?>
<results>
<result>
<author>
<name>Pankaj</name>
</author>
<numberOfTitles>3</numberOfTitles>
</result>
<result>
<author>
<name>Rob</name>
</author>
<numberOfTitles>1</numberOfTitles>
</result>
<result>
<author>
<name>Bob</name>
</author>
<numberOfTitles>1</numberOfTitles>
</result>
Please help me..
This XQuery 1.0 solution is executable by any compliant XQuery 1.0 processor:
Note: No group by and no distinct-values() are used.
<results>
{
let $entries :=
/*/entry
[for $d in
xs:date(string-join(reverse(tokenize(published, '/')), '-'))
return
xs:date('2012-02-15') le $d and $d le xs:date('2012-02-24')
],
$vals := $entries/author/name
return
for $a in $vals[index-of($vals, .)[1]],
$cnt in count(index-of($vals, $a))
order by $cnt descending
return
<result>
<author>
{$a}
</author>
<numberOfTitles>
{count(index-of($vals, $a))}
</numberOfTitles>
</result>
}
</results>
when applied on the provided XML document:
<entries>
<entry>
<id>1</id>
<published>23/02/2012</published>
<title>Title 1</title>
<content type="html">This is title one</content>
<author>
<name>Pankaj</name>
</author>
</entry>
<entry>
<id>2</id>
<published>22/02/2012</published>
<title>Title 2</title>
<content type="html">This is title two</content>
<author>
<name>Pankaj</name>
</author>
</entry>
<entry>
<id>3</id>
<published>21/02/2012</published>
<title>Title 3</title>
<content type="html">This is title three</content>
<author>
<name>Rob</name>
</author>
</entry>
<entry>
<id>4</id>
<published>20/02/2012</published>
<title>Title 4</title>
<content type="html">This is title four</content>
<author>
<name>Bob</name>
</author>
</entry>
<entry>
<id>5</id>
<published>19/02/2012</published>
<title>Title 1</title>
<content type="html">This is title five</content>
<author>
<name>Pankaj</name>
</author>
</entry>
</entries>
produces the wanted, correct result:
<?xml version="1.0" encoding="UTF-8"?>
<results>
<result>
<author>
<name>Pankaj</name>
</author>
<numberOfTitles>3</numberOfTitles>
</result>
<result>
<author>
<name>Rob</name>
</author>
<numberOfTitles>1</numberOfTitles>
</result>
<result>
<author>
<name>Bob</name>
</author>
<numberOfTitles>1</numberOfTitles>
</result>
</results>
Here is a solution specific to MarkLogic, using maps to implement grouping efficiently. The input XML has been declared as $INPUT, but you could replace that with a call to doc() or any other accessor.
I also explored this topic in a blog post last year: http://blakeley.com/blogofile/archives/560/
element results {
let $m := map:map()
let $start := xs:date('2012-02-15')
let $stop := xs:date('2012-02-24')
let $group :=
for $entry in $INPUT/entry
let $key := $entry/author/name/string()
let $date := xs:date(xdmp:parse-yymmdd("dd/MM/yyyy", $entry/published))
where $date ge $start and $date le $stop
return map:put($m, $key, 1 + (map:get($m, $key), 0)[1])
for $key in map:keys($m)
let $count := map:get($m, $key)
order by $count
return element result {
element author { element name { $key }},
element numberOfTitles { $count } } }
Here's my go at a solution:
<results>{
for $entry in //entry
let $date := xs:date(string-join(reverse(tokenize($entry/published, '/')), '-')),
$author := $entry/author/string()
where xs:date('2012-02-15') le $date and $date le xs:date('2012-02-24')
group by $author
order by count($entry) descending
return <result>{
<author>
<name>{$author}</name>
</author>,
<numberOfTitles>{count($entry)}</numberOfTitles>
}</result>
}</results>
When executed with BaseX, it yields the correct result.
It uses XQuery 3.0 features like group by, otherwise it would be more complicated. I don't know if MarkLogic supports that.
The following should work in most processors. There are likely more efficient queries in MarkLogic you could make, but this will get you started.
let $doc := <entries>
<entry>
<id>1</id>
<published>23/02/2012</published>
<title>Title 1</title>
<content type="html">This is title one</content>
<author>
<name>Pankaj</name>
</author>
</entry>
<entry>
<id>2</id>
<published>22/02/2012</published>
<title>Title 2</title>
<content type="html">This is title two</content>
<author>
<name>Pankaj</name>
</author>
</entry>
<entry>
<id>3</id>
<published>21/02/2012</published>
<title>Title 3</title>
<content type="html">This is title three</content>
<author>
<name>Rob</name>
</author>
</entry>
<entry>
<id>4</id>
<published>20/02/2012</published>
<title>Title 4</title>
<content type="html">This is title four</content>
<author>
<name>Bob</name>
</author>
</entry>
<entry>
<id>5</id>
<published>19/02/2012</published>
<title>Title 1</title>
<content type="html">This is title five</content>
<author>
<name>Pankaj</name>
</author>
</entry>
</entries>
return
<results>
{
for $author in distinct-values($doc/entry/author/name/string())
return
<result><author>
<name>{$author}</name>
<numberOfTitles>{count($doc/entry[author/name/string() eq $author])} </numberOfTitles>
</author></result>
}
</results>
Here's another solution that is similar to Leo Wörteler:
declare function local:FormatDate($origDate as xs:string) as xs:date
{
xs:date(string-join(reverse(tokenize($origDate, '/')), '-'))
};
<results>
{
for $author in distinct-values(/entries/entry/author/name)
let $startDate := xs:date('2012-02-15')
let $endDate := xs:date('2012-02-24')
order by count(/entries/entry[author/name=$author][$startDate <= local:FormatDate(published) and local:FormatDate(published) <= $endDate]) descending
return
<result>
<author>
<name>{$author}</name>
</author>
<numberOfTitles>{count(/entries/entry[author/name=$author][$startDate <= local:FormatDate(published) and local:FormatDate(published) <= $endDate])}</numberOfTitles>
</result>
}
</results>
Related
Hallo i'm hosting a Private Gallery of Visual Studio Extensions.
I have 1 Extension for Visual Stduio 2019 only and
one version for Visual Studio 2022 only but when i'm looking into Visual Studio 2019 | 2022 ->Tools->Manage Extensions -> Online -> Private Gallery it shows me both version.
Wher is my mistake ?
Feedfile:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Private Gallery</title>
<id>1111111-2222-3333-444-5555555555</id>
<updated>2022-02-10T08:06:27Z</updated>
<subtitle>Add this feed to Visual Studio's extension manager from Tools -> Options -> Environment -> Extensions and Updates</subtitle>
<link rel="alternate" href="http://test.de/Vsix/Zoom.xml" />
<entry>
<Id>555555-4444-3333-2222-111111111111</Id>
<title type="text">Zoom Support for Visual Studio</title>
<link rel="alternate" href="http://test.de/Vsix/Zoom\doku" />
<link rel="releasenotes" type="text/html" href="http://test.de/Vsix/Zoom/changelog" />
<summary type="text">Built-in support for Zooming with Microsoft Visual Studio.</summary>
<published>2020-01-14T12:54:26Z</published>
<updated>2022-10-11T07:14:41Z</updated>
<author>
<name>Test GmbH</name>
</author>
<content type="application/octet-stream" src="http://test.de/Vsix/Zoom/Zoom.vsix" />
<link rel="icon" href="http://test.de/Vsix/Zoom/Zoom.ico" />
<link href="http://test.de/Vsix/Zoom/Zoom.ico" rel="previewimage" />
<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
<Id>555555-4444-3333-2222-111111111111</Id>
<Version>3.19</Version>
<VersionRange>[16.0,17.0)</VersionRange>
<References />
<Installations>
<VersionRange>[16.0,17.0)</VersionRange>
</Installations>
</Vsix>
</entry>
<entry>
<id>22222222-999-888-7777-55555555555</id>
<title type="text">Zoom Support for Visual Studio</title>
<link rel="alternate" href="http://test.de/Vsix/Zoom\doku" />
<link rel="releasenotes" type="text/html" href="http://test.de/Vsix/Zoom/changelog" />
<summary type="text">Built-in support for Zooming with Microsoft Visual Studio.</summary>
<published>2020-01-14T12:54:26Z</published>
<updated>2022-10-13T08:11:10Z</updated>
<author>
<name>Test GmbH</name>
</author>
<content type="application/octet-stream" src="http://test.de/Vsix/Zoom/Zoom_2022.vsix" />
<link rel="icon" href="http://test.de/Vsix/Zoom/Zoom.ico" />
<link href="http://test.de/Vsix/Zoom/Zoom.ico" rel="previewimage" />
<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/developer/vsx-syndication-schema/2010">
<Id>66666666-777-8888-9999-111111111111</Id>
<Version>1.39</Version>
<VersionRange>[17.0,18.0)</VersionRange>
<ProductArchitecture>amd64</ProductArchitecture>
<References />
<Installations>
<VersionRange>[17.0,18.0)</VersionRange>
</Installations>
</Vsix>
</entry>
</feed>
so we have a kind of normal dynamic sulu 1.6 content structure:
<template>
<properties>
<section name="highlight">
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="en">Title</title>
<title lang="de">Titel</title>
</meta>
<params>
<param name="headline" value="true"/>
</params>
<tag name="sulu.rlp.part"/>
</property>
<property name="headline" type="text_line" mandatory="false">
<meta>
<title lang="en">Alternative Content Headline</title>
<title lang="de">Alternative Inhalts Überschrift</title>
</meta>
</property>
</section>
<block name="mainContent" default-type="article" colspan="8">
<types>
<!-- some types -->
<type name="article">
<meta>
<title lang="de">Artikel</title>
<title lang="en">Article</title>
</meta>
<properties>
<property name="headline" type="text_line"/>
<property name="teaser" type="text_editor"/>
<property name="content" type="text_editor"/>
<property name="mode" type="single_select">
<params>
<param name="values" type="collection">
<param name="simple">
<meta>
<title lang="de">Einfach</title>
<title lang="en">Simple</title>
</meta>
</param>
<param name="collapsible">
<meta>
<title lang="de">Ausklappbar</title>
<title lang="en">Collapsible</title>
</meta>
</param>
</param>
</params>
</property>
<property name="image" type="media_selection"/>
</properties>
</type>
</types>
</block>
</properties>
</template>
If I search now, sulu finds perfectly matches of the tile, but non hidden in the dynamic block content.
I checked out http://docs.sulu.io/en/latest/bundles/search.html and https://massivesearchbundle.readthedocs.io/en/latest/introduction.html but it is not clear to me, how to make this happen. Is there a way for the massive search bundle to also build an index over free text fields?
I would be interested in taking content from properties > block[name=mainContent] > types > type[name=article] > property[name=content] into account (and also property[name=teaser] of course). It can be 0 - n occurences in a page thou.
Thx a lot for any hint on this :)
Andreas
Inside blocks you should be able to add a field to the search with example:
<property name="article" type="text_editor">
<meta>
<title lang="en">Article</title>
</meta>
<tag name="sulu.search.field" />
</property>
See also http://docs.sulu.io/en/latest/book/templates.html#search
I added a new .xml file to my Resources/pages folder.
Filename is called publication.xml
I added my properties and the unique key. But I can't see the
name in the dropdown where i can choose the type of a new entry.
I tried to clear the cache already.
What am I doing wrong?
Here is the content of my publication.xml (closing template-Tag stripped by the editor here on stackoverflow?! It's there in my code)
<?xml version="1.0" ?>
<template xmlns="http://schemas.sulu.io/template/template"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd">
<key>publication</key>
<view>ClientWebsiteBundle:templates:default</view>
<controller>SuluWebsiteBundle:Default:index</controller>
<cacheLifetime>2400</cacheLifetime>
<meta>
<title lang="de">Publikation</title>
<title lang="en">Publication</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Titel</title>
<title lang="en">Title</title>
</meta>
<tag name="sulu.rlp.part"/>
</property>
<property name="url" type="resource_locator" mandatory="true">
<meta>
<title lang="de">Adresse</title>
<title lang="en">Resourcelocator</title>
</meta>
<tag name="sulu.rlp"/>
<tag name="sulu.search.field" role="description"/>
</property>
<property name="tags" type="tag_list">
<meta>
<title lang="de">Tags</title>
</meta>
</property>
<property name="images" type="media_selection">
<tag name="sulu.search.field" role="image" index="false"/>
<meta>
<title lang="de">Vorschaubild</title>
<title lang="en">Preview Image</title>
</meta>
</property>
<property name="article" type="text_editor">
<meta>
<title lang="de">Teaser</title>
<title lang="en">Teaser</title>
</meta>
<params>
<param name="height" value="100"/>
<param name="max_height" value="500" />
<param name="paste_from_word" value="true"/>
</params>
</property>
<section name="content">
<meta>
<title lang="de">Inhalt</title>
<title lang="en">Content</title>
<info_text lang="de">Bereich für den Inhalt</info_text>
<info_text lang="en">Content Section</info_text>
</meta>
<properties>
<block name="block"
default-type="editor"
minOccurs="0"
maxOccurs="125">
<meta>
<title lang="de">Inhalt</title>
<title lang="en">Contant</title>
</meta>
<types>
<type name="headline_1">
<meta>
<title lang="de">Überschrift 1</title>
<title lang="en">Headline 1</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Überschrift 1</title>
<title lang="en">Headline 1</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
</properties>
</type>
<type name="headline_2">
<meta>
<title lang="de">Überschrift 2</title>
<title lang="en">Headline 2</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Überschrift 2</title>
<title lang="en">Headline 2</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
</properties>
</type>
<type name="headline_3">
<meta>
<title lang="de">Überschrift 3</title>
<title lang="en">Headline 3</title>
</meta>
<properties>
<property name="title" type="text_line" mandatory="true">
<meta>
<title lang="de">Überschrift 3</title>
<title lang="en">Headline 3</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
</properties>
</type>
<type name="editor">
<meta>
<title lang="de">Texteditor</title>
<title lang="en">Text editor</title>
</meta>
<properties>
<property name="article" type="text_editor">
<meta>
<title lang="de">Artikel</title>
<title lang="en">Article</title>
</meta>
</property>
</properties>
</type>
<type name="image">
<meta>
<title lang="de">Bild</title>
<title lang="en">Image</title>
</meta>
<properties>
<property name="images" type="media_selection">
<meta>
<title lang="de">Bild</title>
<title lang="en">Image</title>
</meta>
<params>
<param name="types" value="image,video"/>
<param name="displayOptions" type="collection">
<param name="leftTop" value="false"/>
<param name="top" value="true"/>
<param name="rightTop" value="false"/>
<param name="left" value="true"/>
<param name="middle" value="false"/>
<param name="right" value="true"/>
<param name="leftBottom" value="false"/>
<param name="bottom" value="true"/>
<param name="rightBottom" value="false"/>
</param>
<param name="defaultDisplayOption" value="top"/>
</params>
<tag name="sulu.content.sortmode.show"/>
</property>
</properties>
</type>
<type name="gallery">
<meta>
<title lang="de">Galerie</title>
<title lang="en">Gallery</title>
</meta>
<properties>
<property name="images" type="media_selection">
<meta>
<title lang="de">Coverbilder</title>
<title lang="en">images</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
</properties>
</type>
<type name="video">
<meta>
<title lang="de">Video</title>
<title lang="en">Video</title>
</meta>
<properties>
<property name="video_id" type="text_line" mandatory="true">
<meta>
<title lang="de">Youtube VideoID</title>
<title lang="en">Youtube VideoID</title>
</meta>
<tag name="sulu.content.sortmode.show"/>
</property>
</properties>
</type>
</types>
</block>
</properties>
</section>
</properties>
We have decided to only show the template in the dropdown if there is also a corresponding twig template in the html format. We did so, because otherwise it would be impossible to correctly show something in the live preview.
Since this seems to be a common caveat I already created a PR for the documentation
Daniel posted the answer to my question in the comments.
Have you already implemented a html twig template ending with .html.twig? Only templates with an existing html template are shown in the dropdown.
Thanks a lot!
How would I take all element nodes of the same name, and combine them together into one that retains the child elements of each?
Example input:
<topic>
<title />
<language />
<more-info>
<itunes />
</more-info>
<more-info>
<imdb />
</more-info>
<more-info>
<netflix />
</more-info>
</topic>
Example output (all of the more-infos are collapsed into a single element):
<topic>
<title />
<language />
<more-info>
<itunes />
<imdb />
<netflix />
</more-info>
</topic>
Edit: I am looking for a way to do this without knowing which node names reoccur. So, with the example above, I could not use a script that only targeted more-info, as there may be other elements that also need to have the same process applied to them.
Use:
declare option saxon:output "omit-xml-declaration=yes";
<topic>
<title />
<language />
<more-info>
{for $inf in /*/more-info/node()
return $inf
}
</more-info>
</topic>
When this XQuery is applied on the provided XML document:
<topic>
<title />
<language />
<more-info>
<itunes />
</more-info>
<more-info>
<imdb />
</more-info>
<more-info>
<netflix />
</more-info>
</topic>
the wanted, correct result is produced:
<topic>
<title/>
<language/>
<more-info>
<itunes/>
<imdb/>
<netflix/>
</more-info>
</topic>
I came with that:
for $n in $nodes/node()
let $lname := local-name($n)
group by $lname
return element {$lname} {
$n/node()
}
Where $nodes contains the input document.
It uses a group by which will bind the $n variable to the list of grouped nodes.
So, the expression $n/node() represent a sequence of node.
To make it recursive, we have to declare a function and call it:
declare function local:recurse($node){
for $n in $node/text() return $n,
for $n in $node/element()
let $lname := local-name($n)
group by $lname
return element {$lname} {
for $m in $n return local:recurse($m)
}
};
local:recurse($nodes)
The first line ends with a comma. It's a list concatenation. So, we output text nodes first, then element nodes with the group by sheningan explained above.
XML Input
<topic>
<title>Test</title>
<language />
<more-info>
<itunes>
<playlist>
<item>2</item>
</playlist>
<playlist>
<item>3</item>
</playlist>
</itunes>
</more-info>
<more-info>
<imdb>Imdb info</imdb>
</more-info>
<more-info>
<netflix>Netflix info</netflix>
</more-info>
</topic>
XML Output
<title>Test</title>
<language/>
<more-info>
<itunes>
<playlist>
<item>2</item>
<item>3</item>
</playlist>
</itunes>
<imdb>Imdb info</imdb>
<netflix>Netflix info</netflix>
</more-info>
Remarks
I have no clues why XSLT is deemed easier. Maybe the apply-templates is masquerading the recursion, making it less intimidating.
Also, the fact that the matching is declared outside the "loop" make it easier (then, has to be paired with mode for full control) compared to XQuery which required it inside the "loop".
Whatever, in this peculiar example, XQuery seems to be very appropriate.
This seems like a better job for XSLT if you can use it.
XML Input
<topic>
<title />
<language />
<more-info>
<itunes />
</more-info>
<more-info>
<imdb />
</more-info>
<more-info>
<netflix />
</more-info>
</topic>
XSLT 2.0
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/*">
<xsl:copy>
<xsl:apply-templates select="#*"/>
<xsl:for-each-group select="*" group-by="name()">
<xsl:copy>
<xsl:apply-templates select="current-group()/#*"/>
<xsl:apply-templates select="current-group()/*"/>
</xsl:copy>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
XML Output
<topic>
<title/>
<language/>
<more-info>
<itunes/>
<imdb/>
<netflix/>
</more-info>
</topic>
Trying to read an RSS and select information using Linq but can't seem to get it working.
Here is my code:
XDocument feedXML = XDocument.Load(
"http://eventful.com/atom/performers/bliminal-/P0-001-000192452-0");
var feeds = from feed in feedXML.Descendants("entry")
select new
{
Title = feed.Element("title").Value,
Link = feed.Element("link").Value,
Description = feed.Element("content").Value
};
And here is the format of my RSS:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US" xmlns:g="http://base.google.com/ns/1.0" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<id>http://eventful.com/atom/performers/bliminal-/P0-001-000192452-0</id>
<link href="http://eventful.com/atom/performers/bliminal-/P0-001-000192452-0" type="application/atom+xml" rel="self" />
<link href="http://eventful.com/performers/bliminal-/P0-001-000192452-0" type="text/html" rel="alternate" />
<title>B-Liminal Tour Dates in 2009, B-Liminal Concert Schedule - Eventful</title>
<subtitle>Up-to-date event feeds from eventful.com, the world's leading event website.</subtitle>
<rights type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
Copyright © 2006
Eventful, Inc. All rights reserved. Use subject to terms of use:
http://eventful.com/terms
</div>
</rights>
<generator version="1.0">EVDB::Atom</generator>
<opensearch:totalResults></opensearch:totalResults>
<opensearch:startIndex>1</opensearch:startIndex>
<updated>2009-09-13T11:48:52+00:00</updated>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<id>http://eventful.com/jupiter/events/bliminal-free-fan-appreciation-show-/E0-001-024704319-1</id>
<published>2009-09-13T15:09:00+00:00</published>
<updated>2009-09-13T15:48:12+00:00</updated>
<link href="http://eventful.com/jupiter/events/bliminal-free-fan-appreciation-show-/E0-001-024704319-1" type="text/html" rel="alternate" />
<gd:eventStatus value="http://schemas.google.com/g/2005#event.confirmed" />
<gd:visibility value="http://schemas.google.com/g/2005#event.public" />
<gd:transparency value="http://schemas.google.com/g/2005#event.transparent" />
<title>B-Liminal FREE fan appreciation show!</title>
<gd:when startTime="2009-09-19T02:00:00+00:00" endTime="2009-09-19T02:00:00+00:00" />
<georss:where>
<gml:Point>
<gml:pos>26.9342076 -80.0922588</gml:pos>
</gml:Point>
</georss:where>
<gd:where rel="http://schemas.google.com/g/2005#event" valueString="Corners near 71 East Indiantown Road , Jupiter, Florida, 33458, United States">
<gd:entryLink>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<id>http://eventful.com/jupiter/venues/corners-/V0-001-001473018-9</id>
<link href="http://eventful.com/jupiter/venues/corners-/V0-001-001473018-9" type="text/html" rel="alternate" />
<title>Corners</title>
<georss:where>
<gml:Point>
<gml:pos>26.9342076 -80.0922588</gml:pos>
</gml:Point>
</georss:where>
<gd:contactSection label="Corners">
<gd:postalAddress>
71 East Indiantown Road
Jupiter, Florida 33458, United States
</gd:postalAddress>
<gd:geoPt lat="26.9342076" lon="-80.0922588" />
</gd:contactSection>
<content type="html">
<div class='vcard'>
<a class='fn org url uid' href='http://eventful.com/venues/V0-001-001473018-9'>Corners</a>
<div class='adr'>
<span class='street-address'>71 East Indiantown Road</span>, <span class='locality'>Jupiter</span>, <span class='region'>Florida</span> <span class='postal-code'>33458</span> <span class='country-name'>United States</span></div>
</div>
</content>
<media:text type="html">
<div class='vcard'>
<a class='fn org url uid' href='http://eventful.com/venues/V0-001-001473018-9'>Corners</a>
<div class='adr'>
<span class='street-address'>71 East Indiantown Road</span>, <span class='locality'>Jupiter</span>, <span class='region'>Florida</span> <span class='postal-code'>33458</span> <span class='country-name'>United States</span></div>
</div>
</media:text>
<category scheme="http://eventful.com/venues/tags/" term="americantowns" label="American Towns" />
<category scheme="http://eventful.com/venues/tags/" term="americantownscom" label="americantowns.com" />
<category scheme="http://eventful.com/venues/tags/" term="artistdatacom" label="artistdata.com" />
<category scheme="http://eventful.com/venues/tags/" term="barnightclub" label="BarNight Club" />
<category scheme="http://eventful.com/venues/tags/" term="community" label="community" />
<category scheme="http://eventful.com/venues/tags/" term="local" label="local" />
<category scheme="http://eventful.com/venues/tags/" term="townsquare" label="town square" />
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/g/2005#contact" />
<author>
<name>evdb</name>
<uri>http://eventful.com/users/evdb</uri>
</author>
</entry>
</gd:entryLink>
</gd:where>
The problem is that the entry elements are in an XML namespace (the xmlns attribute in each entry).
You need to do this:
XNamespace atom = "http://www.w3.org/2005/Atom";
var feeds = from feed in feedXML.Descendants(atom + "entry")
select new {
Title = feed.Element(atom + "title").Value,
Link = feed.Element(atom + "link").Value,
Description = feed.Element(atom + "content").Value
};
This code uses an implicit cast to create an XNamespace object, then uses XNamespace's overloaded + operator to create an XName. For more information, see here.