Josh Asbury Vor 15 Jahren Sniff. Sniff. <wipes tears from eyes>. That's beautiful. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Rob Sonke Vor 15 Jahren Oh Ray, that's really cool! I always enjoy your blogs but this was one was great! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Michael Young Vor 15 Jahren What did your friends get you into...There's a world of possibility with this. Nice Ray. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Sabine Winkler Vor 15 Jahren Ray, that's really fine. may be you could help me with the following questions:<a href='http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1386734'>http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1386734</a>Thanks in advance. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
nek konstantopoulos Vor 15 Jahren Oh Ray, that's a beautifull job ... its nice to share this with us! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Josh Asbury Vor 15 Jahren Hey Ray - I am implementing this on 5.2, and I'm seeing some strange behavior with the way the links are handled. Put simply, they're not loading the articles with the code above...just refreshing the journal content in maximized view. Has something changed in the way these are handled? Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Josh Asbury Josh Asbury Vor 15 Jahren FYI, I tried this out at 5.1.2 and found the same behavior with render-url. I was able to get it working through other means, though. Another question, though: is it possible to pull journal articles by tag ID in this manner? I'm trying to create a stripped-down version of the Asset Publisher using this mechanism that will allow me to style the content in any way that I want. Should be cool if I can figure this last part out! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Josh Asbury Josh Asbury Vor 15 Jahren FYI, I tried this out at 5.1.2 and found the same behavior with render-url. I was able to get it working through other means, though. Another question, though: is it possible to pull journal articles by tag ID in this manner? I'm trying to create a stripped-down version of the Asset Publisher using this mechanism that will allow me to style the content in any way that I want. Should be cool if I can figure this last part out! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Peter Mesotten Vor 15 Jahren Is there any way to easily reverse the list of returned nodes? I know you can add a sort-XPath to the selectNodes function, like this:#set ($articles = $root.selectNodes("/result-set/result/root", "dynamic-element[@name='date']/dynamic-content"))This list returns me a sorted list of articles indeed, but in ascending order, while I want them in descending order. Is this possible in the sort-xpath parameter, or with any list util? (I don't find any reverse-like feature in the Liferay utils)Sorting is one of those things that remains the easiest in XSL :-) Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen abdul quddhus Peter Mesotten Vor 13 Jahren Dears, issue with Liferay 6.0.5 + Jboss Bundle.below is the code snippet:#set ($document = $saxReaderUtil.readURL("http://@portal_url@/c/journal/get_articles?groupId=@group_id@&type=general&delta=1&approved=true&expired=false&orderBy=display-date"))#set ($root = $document.getRootElement())##$root has the xml document object, if printed using $root.asXML(), it displays xml data##from below code it does not work properly#set ($articles = $root.selectNodes("/result-set/result/root"))$articles is coming empty, how to proceed further. Appreciate if anyone can help with code snippet along with opening the article in maximized mode. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé abdul quddhus Vor 13 Jahren I've been trying to get back to you on this. To me it looks right! I have to setup a small test example.I'll try by early next at the latest! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen delang j Ray Augé Vor 13 Jahren hi ray,i already opened up new thread here http://www.liferay.com/community/forums/-/message_boards/message/7681234?_19_preview=falsethanks Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen abdul quddhus Ray Augé Vor 13 Jahren Hi Ray, thanks for respoding, any update on this? if this works it would save me creating new custom porlet for News Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
abdul quddhus Peter Mesotten Vor 13 Jahren Dears, issue with Liferay 6.0.5 + Jboss Bundle.below is the code snippet:#set ($document = $saxReaderUtil.readURL("http://@portal_url@/c/journal/get_articles?groupId=@group_id@&type=general&delta=1&approved=true&expired=false&orderBy=display-date"))#set ($root = $document.getRootElement())##$root has the xml document object, if printed using $root.asXML(), it displays xml data##from below code it does not work properly#set ($articles = $root.selectNodes("/result-set/result/root"))$articles is coming empty, how to proceed further. Appreciate if anyone can help with code snippet along with opening the article in maximized mode. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé abdul quddhus Vor 13 Jahren I've been trying to get back to you on this. To me it looks right! I have to setup a small test example.I'll try by early next at the latest! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen delang j Ray Augé Vor 13 Jahren hi ray,i already opened up new thread here http://www.liferay.com/community/forums/-/message_boards/message/7681234?_19_preview=falsethanks Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen abdul quddhus Ray Augé Vor 13 Jahren Hi Ray, thanks for respoding, any update on this? if this works it would save me creating new custom porlet for News Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Ray Augé abdul quddhus Vor 13 Jahren I've been trying to get back to you on this. To me it looks right! I have to setup a small test example.I'll try by early next at the latest! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen delang j Ray Augé Vor 13 Jahren hi ray,i already opened up new thread here http://www.liferay.com/community/forums/-/message_boards/message/7681234?_19_preview=falsethanks Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen abdul quddhus Ray Augé Vor 13 Jahren Hi Ray, thanks for respoding, any update on this? if this works it would save me creating new custom porlet for News Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
delang j Ray Augé Vor 13 Jahren hi ray,i already opened up new thread here http://www.liferay.com/community/forums/-/message_boards/message/7681234?_19_preview=falsethanks Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
abdul quddhus Ray Augé Vor 13 Jahren Hi Ray, thanks for respoding, any update on this? if this works it would save me creating new custom porlet for News Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
delang j Vor 13 Jahren hi,instead of clicking the link to display article, how do i display content?#set ($contentC = $article.selectSingleNode("static-content[@language-id='en_US']/static-content"))i try this but doesnt work, pls help. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen delang j delang j Vor 13 Jahren sorrythis is the correct one#set ($contentC = $article.selectSingleNode("static-content"))but the content does change according to languageId. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
delang j delang j Vor 13 Jahren sorrythis is the correct one#set ($contentC = $article.selectSingleNode("static-content"))but the content does change according to languageId. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Guillaume Lhermitte Vor 12 Jahren Thank you for this piece of code and those rich ideas ! Thanks for sharing this. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
delang j Vor 11 Jahren hi,does anyone applied to 6.1 version?mines not working. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Vladimir Vukadinovic delang j Vor 11 Jahren hi, is it work on 6.1?or how I get articles in template on different way?tnx Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Juanma Lopez Vladimir Vukadinovic Vor 11 Jahren Well...if I do this:#set ($document = $saxReaderUtil.readURL("http://@portal_url@/$!{request.locale}/c/journal/get_articles?groupId=@group_id@&type=news&templateId=FICHA_NOTICIA&delta=6&approved=true&expired=false&orderBy=display-date"))#set ($root = $document.getRootElement())#set ($articles = $root.selectNodes("/result-set/result/root"))Fails!But if I do:#set ($document = $saxReaderUtil.readURL("http://localhost:8080/$!{request.locale}/c/journal/get_articles?groupId=@group_id@&type=news&templateId=FICHA_NOTICIA&delta=6&approved=true&expired=false&orderBy=display-date"))#set ($root = $document.getRootElement())#set ($articles = $root.selectNodes("/result-set/result/root"))Works!Note that the only change I made is change @portal_url@ constant for hardcoded URL 'localhost:8080'. I don't understand but works... Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Juanma Lopez Juanma Lopez Vor 11 Jahren I forgot to say that in version 6.1.0 don't work. Version 6.0.6 works with @portal_url@. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé Juanma Lopez Vor 11 Jahren Yes, unfortunately this is a known bug.http://issues.liferay.com/browse/LPS-29202Fortunately the fix is very simple: https://github.com/liferay/liferay-portal/commit/c54b27bfb8 (I believe this is also available in a post EE-GA2 fixpack). Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Vladimir Vukadinovic delang j Vor 11 Jahren hi, is it work on 6.1?or how I get articles in template on different way?tnx Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Juanma Lopez Vladimir Vukadinovic Vor 11 Jahren Well...if I do this:#set ($document = $saxReaderUtil.readURL("http://@portal_url@/$!{request.locale}/c/journal/get_articles?groupId=@group_id@&type=news&templateId=FICHA_NOTICIA&delta=6&approved=true&expired=false&orderBy=display-date"))#set ($root = $document.getRootElement())#set ($articles = $root.selectNodes("/result-set/result/root"))Fails!But if I do:#set ($document = $saxReaderUtil.readURL("http://localhost:8080/$!{request.locale}/c/journal/get_articles?groupId=@group_id@&type=news&templateId=FICHA_NOTICIA&delta=6&approved=true&expired=false&orderBy=display-date"))#set ($root = $document.getRootElement())#set ($articles = $root.selectNodes("/result-set/result/root"))Works!Note that the only change I made is change @portal_url@ constant for hardcoded URL 'localhost:8080'. I don't understand but works... Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Juanma Lopez Juanma Lopez Vor 11 Jahren I forgot to say that in version 6.1.0 don't work. Version 6.0.6 works with @portal_url@. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé Juanma Lopez Vor 11 Jahren Yes, unfortunately this is a known bug.http://issues.liferay.com/browse/LPS-29202Fortunately the fix is very simple: https://github.com/liferay/liferay-portal/commit/c54b27bfb8 (I believe this is also available in a post EE-GA2 fixpack). Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Juanma Lopez Vladimir Vukadinovic Vor 11 Jahren Well...if I do this:#set ($document = $saxReaderUtil.readURL("http://@portal_url@/$!{request.locale}/c/journal/get_articles?groupId=@group_id@&type=news&templateId=FICHA_NOTICIA&delta=6&approved=true&expired=false&orderBy=display-date"))#set ($root = $document.getRootElement())#set ($articles = $root.selectNodes("/result-set/result/root"))Fails!But if I do:#set ($document = $saxReaderUtil.readURL("http://localhost:8080/$!{request.locale}/c/journal/get_articles?groupId=@group_id@&type=news&templateId=FICHA_NOTICIA&delta=6&approved=true&expired=false&orderBy=display-date"))#set ($root = $document.getRootElement())#set ($articles = $root.selectNodes("/result-set/result/root"))Works!Note that the only change I made is change @portal_url@ constant for hardcoded URL 'localhost:8080'. I don't understand but works... Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Juanma Lopez Juanma Lopez Vor 11 Jahren I forgot to say that in version 6.1.0 don't work. Version 6.0.6 works with @portal_url@. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé Juanma Lopez Vor 11 Jahren Yes, unfortunately this is a known bug.http://issues.liferay.com/browse/LPS-29202Fortunately the fix is very simple: https://github.com/liferay/liferay-portal/commit/c54b27bfb8 (I believe this is also available in a post EE-GA2 fixpack). Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Juanma Lopez Juanma Lopez Vor 11 Jahren I forgot to say that in version 6.1.0 don't work. Version 6.0.6 works with @portal_url@. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé Juanma Lopez Vor 11 Jahren Yes, unfortunately this is a known bug.http://issues.liferay.com/browse/LPS-29202Fortunately the fix is very simple: https://github.com/liferay/liferay-portal/commit/c54b27bfb8 (I believe this is also available in a post EE-GA2 fixpack). Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Ray Augé Juanma Lopez Vor 11 Jahren Yes, unfortunately this is a known bug.http://issues.liferay.com/browse/LPS-29202Fortunately the fix is very simple: https://github.com/liferay/liferay-portal/commit/c54b27bfb8 (I believe this is also available in a post EE-GA2 fixpack). Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
(Sie) Vor 10 Jahren [...] Liferay has an RSS reader portlet that is minimally configurable. You are not limited to this portlet, however. Using the SAXReaderUtil and Velocity you can fairly easily create your own. Check... [...] Read More Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Enrique Valdes Lacasa Vor 9 Jahren Excellent post! Thanks Ray! I was parsing the $xmlRequest variable available in the templates in Liferay 6.2 first...but then I found that using the ${request.theme-display} call instead, I was able to retrieve the theme display so easily! So my question here would be...what is the difference between using the ${request} variable rather than the $xmlRequest one? are they the same object? From my point of view (and sorry if I sound confused) using the ${request} variable is much easier than having to use the SaxReaderUtil...so why using an $xmlRequest variable instead?A little clarification would help, but either way my code is working in my template. Anyways, I am glad that such a "classic" functionality from back in 2008 can still provide such an interesting value in the 6.2 version.Regards Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé Enrique Valdes Lacasa Vor 9 Jahren The $xmlRequest is a xml string consumable by the XSL template engine. You probably don't need it for template languages where you can use the $request hash.HTH Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Enrique Valdes Lacasa Ray Augé Vor 9 Jahren Thanks for the quick answer. I will stick to the $request hash then. I was curious since the $xmlRequest appears as one of the variables available to get with a click on the left panel from the templates editor (Liferay 6.2 ga2 CE.).. So I imagined that I would have to use it to get variables from the request. But your post and comment clarified it, thanks! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Ray Augé Enrique Valdes Lacasa Vor 9 Jahren The $xmlRequest is a xml string consumable by the XSL template engine. You probably don't need it for template languages where you can use the $request hash.HTH Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Enrique Valdes Lacasa Ray Augé Vor 9 Jahren Thanks for the quick answer. I will stick to the $request hash then. I was curious since the $xmlRequest appears as one of the variables available to get with a click on the left panel from the templates editor (Liferay 6.2 ga2 CE.).. So I imagined that I would have to use it to get variables from the request. But your post and comment clarified it, thanks! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Enrique Valdes Lacasa Ray Augé Vor 9 Jahren Thanks for the quick answer. I will stick to the $request hash then. I was curious since the $xmlRequest appears as one of the variables available to get with a click on the left panel from the templates editor (Liferay 6.2 ga2 CE.).. So I imagined that I would have to use it to get variables from the request. But your post and comment clarified it, thanks! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
s s Vor 9 Jahren Hi, I've had good luck using method this to read some external rss feeds with rss\channel\item in the xml but having problems with others that use feed\entry in the xml. Maybe it is the ATOM type\dom vs whatever that is a problem? An example of one I can't parse\read is http://weather.gc.ca/rss/city/on-69_e.xml. Any help how to read\parse that xml greater appreciated -- working only in velocity script. Thanks! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren Seems like it should be parseable! Are you getting an error? Might just be that your parser logic is not tuned for this particular format? There are several RSS formats and versions of each format out there. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Hey Ray - thanks for fast reply (and awesome blogging in general); No errors, just don't seem to get anything back with selectNodes - tried a dozen things instead of feed\entry (inc nothing and //entry). Here is a snippet of code (it's a tab based RSS reader, was also gonna add paging). can send you whole script if there is a way)...<code>#foreach ($item in $feed.getSiblings()) <div id="tabs-$velocityCount"> #set ($feedDoc = $saxReaderUtil.readURL("$item.feedURL.getData()")) #if ($item.feedNode.data == '1') <p>got a 1 $item.feedURL.getData()</p> #set ($feedItems = $feedDoc.selectNodes("/feed/entry")) #else #set ($feedItems = $feedDoc.selectNodes("/rss/channel/item")) #end <ul style="list-style-position: inside; white-space: nowrap; overflow: hidden;"> #if ($feedItems.isEmpty()) <p><li>Nothing to report.</li></p> #end #foreach ($feedItem in $feedItems)<\code> Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren Ah, it's the schema! You need to do it like so:/*[local-name() = feed]/*[local-name() = entry]etc. Or you have to use the XPath API to pass in namespace URI which would let you do something like:x = http://www.w3.org/2005/Atom/x:feed/x:entryThe Java code looks like this:XPath xPath = SAXReaderUtil.createXPath("/x:feed/x:entry", "x", "http://www.w3.org/2005/Atom");List<Node> nodes = xPath.selectNodes(rootElement); Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren You are dealing with a very novice dude here, but I'll try that\those! Thanks. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Getting closer! - this statement is now finding the nodes and the foreach walks through them properly (pretty sure, count is right); #set ($feedItems = $feedDoc.selectNodes("/*[local-name()='feed']/*[local-name()='entry']"))To fetch the attributes (singlenode) out of it, I was using the statement below for regular xml but it does not work for this one (I tried putting the /*[ stuff in there where title is but no go; (within foreach) #set($entryTitle = $feedItem.selectSingleNode('title').getData())Ideas? Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren The attributes are just as namespaced as the elements. Welcome to the joy that is xml parsing! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Tried something like this (but doesn't work; sorry to be so clueless);#set($feedItemNode = $feedItem.selectSingleNode("/*[local-name()='title']"))#set($entryTitle = $feedItemNode.getData()) Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren attributes you handle like this:@*[local-name()='name'Also, you don't use the selectSingleNode for attributes. You use the attribute getters. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Ray Augé s s Vor 9 Jahren Seems like it should be parseable! Are you getting an error? Might just be that your parser logic is not tuned for this particular format? There are several RSS formats and versions of each format out there. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Hey Ray - thanks for fast reply (and awesome blogging in general); No errors, just don't seem to get anything back with selectNodes - tried a dozen things instead of feed\entry (inc nothing and //entry). Here is a snippet of code (it's a tab based RSS reader, was also gonna add paging). can send you whole script if there is a way)...<code>#foreach ($item in $feed.getSiblings()) <div id="tabs-$velocityCount"> #set ($feedDoc = $saxReaderUtil.readURL("$item.feedURL.getData()")) #if ($item.feedNode.data == '1') <p>got a 1 $item.feedURL.getData()</p> #set ($feedItems = $feedDoc.selectNodes("/feed/entry")) #else #set ($feedItems = $feedDoc.selectNodes("/rss/channel/item")) #end <ul style="list-style-position: inside; white-space: nowrap; overflow: hidden;"> #if ($feedItems.isEmpty()) <p><li>Nothing to report.</li></p> #end #foreach ($feedItem in $feedItems)<\code> Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren Ah, it's the schema! You need to do it like so:/*[local-name() = feed]/*[local-name() = entry]etc. Or you have to use the XPath API to pass in namespace URI which would let you do something like:x = http://www.w3.org/2005/Atom/x:feed/x:entryThe Java code looks like this:XPath xPath = SAXReaderUtil.createXPath("/x:feed/x:entry", "x", "http://www.w3.org/2005/Atom");List<Node> nodes = xPath.selectNodes(rootElement); Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren You are dealing with a very novice dude here, but I'll try that\those! Thanks. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Getting closer! - this statement is now finding the nodes and the foreach walks through them properly (pretty sure, count is right); #set ($feedItems = $feedDoc.selectNodes("/*[local-name()='feed']/*[local-name()='entry']"))To fetch the attributes (singlenode) out of it, I was using the statement below for regular xml but it does not work for this one (I tried putting the /*[ stuff in there where title is but no go; (within foreach) #set($entryTitle = $feedItem.selectSingleNode('title').getData())Ideas? Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren The attributes are just as namespaced as the elements. Welcome to the joy that is xml parsing! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Tried something like this (but doesn't work; sorry to be so clueless);#set($feedItemNode = $feedItem.selectSingleNode("/*[local-name()='title']"))#set($entryTitle = $feedItemNode.getData()) Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren attributes you handle like this:@*[local-name()='name'Also, you don't use the selectSingleNode for attributes. You use the attribute getters. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
s s Ray Augé Vor 9 Jahren Hey Ray - thanks for fast reply (and awesome blogging in general); No errors, just don't seem to get anything back with selectNodes - tried a dozen things instead of feed\entry (inc nothing and //entry). Here is a snippet of code (it's a tab based RSS reader, was also gonna add paging). can send you whole script if there is a way)...<code>#foreach ($item in $feed.getSiblings()) <div id="tabs-$velocityCount"> #set ($feedDoc = $saxReaderUtil.readURL("$item.feedURL.getData()")) #if ($item.feedNode.data == '1') <p>got a 1 $item.feedURL.getData()</p> #set ($feedItems = $feedDoc.selectNodes("/feed/entry")) #else #set ($feedItems = $feedDoc.selectNodes("/rss/channel/item")) #end <ul style="list-style-position: inside; white-space: nowrap; overflow: hidden;"> #if ($feedItems.isEmpty()) <p><li>Nothing to report.</li></p> #end #foreach ($feedItem in $feedItems)<\code> Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren Ah, it's the schema! You need to do it like so:/*[local-name() = feed]/*[local-name() = entry]etc. Or you have to use the XPath API to pass in namespace URI which would let you do something like:x = http://www.w3.org/2005/Atom/x:feed/x:entryThe Java code looks like this:XPath xPath = SAXReaderUtil.createXPath("/x:feed/x:entry", "x", "http://www.w3.org/2005/Atom");List<Node> nodes = xPath.selectNodes(rootElement); Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren You are dealing with a very novice dude here, but I'll try that\those! Thanks. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Getting closer! - this statement is now finding the nodes and the foreach walks through them properly (pretty sure, count is right); #set ($feedItems = $feedDoc.selectNodes("/*[local-name()='feed']/*[local-name()='entry']"))To fetch the attributes (singlenode) out of it, I was using the statement below for regular xml but it does not work for this one (I tried putting the /*[ stuff in there where title is but no go; (within foreach) #set($entryTitle = $feedItem.selectSingleNode('title').getData())Ideas? Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren The attributes are just as namespaced as the elements. Welcome to the joy that is xml parsing! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Tried something like this (but doesn't work; sorry to be so clueless);#set($feedItemNode = $feedItem.selectSingleNode("/*[local-name()='title']"))#set($entryTitle = $feedItemNode.getData()) Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren attributes you handle like this:@*[local-name()='name'Also, you don't use the selectSingleNode for attributes. You use the attribute getters. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Ray Augé s s Vor 9 Jahren Ah, it's the schema! You need to do it like so:/*[local-name() = feed]/*[local-name() = entry]etc. Or you have to use the XPath API to pass in namespace URI which would let you do something like:x = http://www.w3.org/2005/Atom/x:feed/x:entryThe Java code looks like this:XPath xPath = SAXReaderUtil.createXPath("/x:feed/x:entry", "x", "http://www.w3.org/2005/Atom");List<Node> nodes = xPath.selectNodes(rootElement); Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren You are dealing with a very novice dude here, but I'll try that\those! Thanks. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Getting closer! - this statement is now finding the nodes and the foreach walks through them properly (pretty sure, count is right); #set ($feedItems = $feedDoc.selectNodes("/*[local-name()='feed']/*[local-name()='entry']"))To fetch the attributes (singlenode) out of it, I was using the statement below for regular xml but it does not work for this one (I tried putting the /*[ stuff in there where title is but no go; (within foreach) #set($entryTitle = $feedItem.selectSingleNode('title').getData())Ideas? Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren The attributes are just as namespaced as the elements. Welcome to the joy that is xml parsing! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Tried something like this (but doesn't work; sorry to be so clueless);#set($feedItemNode = $feedItem.selectSingleNode("/*[local-name()='title']"))#set($entryTitle = $feedItemNode.getData()) Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren attributes you handle like this:@*[local-name()='name'Also, you don't use the selectSingleNode for attributes. You use the attribute getters. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
s s Ray Augé Vor 9 Jahren You are dealing with a very novice dude here, but I'll try that\those! Thanks. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
s s Ray Augé Vor 9 Jahren Getting closer! - this statement is now finding the nodes and the foreach walks through them properly (pretty sure, count is right); #set ($feedItems = $feedDoc.selectNodes("/*[local-name()='feed']/*[local-name()='entry']"))To fetch the attributes (singlenode) out of it, I was using the statement below for regular xml but it does not work for this one (I tried putting the /*[ stuff in there where title is but no go; (within foreach) #set($entryTitle = $feedItem.selectSingleNode('title').getData())Ideas? Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren The attributes are just as namespaced as the elements. Welcome to the joy that is xml parsing! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Tried something like this (but doesn't work; sorry to be so clueless);#set($feedItemNode = $feedItem.selectSingleNode("/*[local-name()='title']"))#set($entryTitle = $feedItemNode.getData()) Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren attributes you handle like this:@*[local-name()='name'Also, you don't use the selectSingleNode for attributes. You use the attribute getters. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Ray Augé s s Vor 9 Jahren The attributes are just as namespaced as the elements. Welcome to the joy that is xml parsing! Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen s s Ray Augé Vor 9 Jahren Tried something like this (but doesn't work; sorry to be so clueless);#set($feedItemNode = $feedItem.selectSingleNode("/*[local-name()='title']"))#set($entryTitle = $feedItemNode.getData()) Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren attributes you handle like this:@*[local-name()='name'Also, you don't use the selectSingleNode for attributes. You use the attribute getters. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
s s Ray Augé Vor 9 Jahren Tried something like this (but doesn't work; sorry to be so clueless);#set($feedItemNode = $feedItem.selectSingleNode("/*[local-name()='title']"))#set($entryTitle = $feedItemNode.getData()) Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen Ray Augé s s Vor 9 Jahren attributes you handle like this:@*[local-name()='name'Also, you don't use the selectSingleNode for attributes. You use the attribute getters. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen
Ray Augé s s Vor 9 Jahren attributes you handle like this:@*[local-name()='name'Also, you don't use the selectSingleNode for attributes. You use the attribute getters. Melden Sie sich an, um auf diesen Beitrag zu antworten. Antworten als... Abbrechen