I have some xml that I'm parsing. Within each structure there are two elements called <link> I need to reference only the second one.
Here's an example of the xml
I need to reference the second <link> element...the one that links to
The way my code is set up right now, it is referencing the first link element. Here's how I'm looping throught the xml:
Can anyone tell me how to set node.link to the second <link> element instead of the first?
Thanks!
Here's an example of the xml
Code:
<entry xmlns="[URL unfurl="true"]http://purl.org/atom/ns#">[/URL]
<link href="[URL unfurl="true"]https://www.blogger.com/atom/13468992/113467358910280087"[/URL] rel="service.edit" title="Lily-Beignet Finds A Home" type="application/atom+xml"/>
<author>
<name>Blythe</name>
</author>
<issued>2005-12-15T10:23:00-08:00</issued>
<modified>2005-12-15T19:08:07Z</modified>
<created>2005-12-15T19:06:29Z</created>
<link href="[URL unfurl="true"]http://shelterlife.blogspot.com/2005/12/lily-beignet-finds-home.html"[/URL] rel="alternate" title="Lily-Beignet Finds A Home" type="text/html"/>
<id>tag:blogger.com,1999:blog-13468992.post-113467358910280087</id>
<title mode="escaped" type="text/html">Lily-Beignet Finds A Home</title>
<content type="application/xhtml+xml" xml:base="[URL unfurl="true"]http://shelterlife.blogspot.com"[/URL] xml:space="preserve">
One of our hurricane dogs, Beignet (Lily to her foster) found a home yesterday. She was adopted by her foster family...
</content>
<draft xmlns="[URL unfurl="true"]http://purl.org/atom-blog/ns#">false</draft>[/URL]
</entry>
I need to reference the second <link> element...the one that links to
The way my code is set up right now, it is referencing the first link element. Here's how I'm looping throught the xml:
Code:
<cfloop index="x" from="1" to="11"><!--- #arrayLen(entries)# --->
<cfset node = structNew() />
<cfset node.author = entries[x].author.name.xmlText />
<cfset node.link = entries[x].link.xmlAttributes.href />
<cfoutput>
<u>Most Recent Entry</u>:<br><br>
Author: #node.author#<br>
Link: #node.link#<br>
</cfoutput>
</cfloop>
Can anyone tell me how to set node.link to the second <link> element instead of the first?
Thanks!