Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
smez

asp + xml

Question

tenho esse script em asp que lê um xml

mas como que eu faço para mostrar o ultimo registro, ele esta mostrando o primeiro, queria que mostrasse o ultimo registro.

url2 = "http://pedronunes.mypodcast.com/rss.xml"
Set xml = Server.CreateObject("MSXML2.DOMDocument.3.0")
xml.async = False
xml.SetProperty "ServerHTTPRequest", True
xml.ValidateOnParse = False
xml.PreserveWhiteSpace = False

If Not xml.Load(url2) Then
  Response.Write "Nenhuma disponivel no momento."
Else
  Set nodeList = xml.getElementsByTagName("item")
  For Each objNode In nodeList
    For Each objNode2 In objNode.childNodes
      Select Case objNode2.nodeName
        Case "title" : title = objNode2.lastChild.nodevalue
        Case "guid"  : guid  = objNode2.lastChild.nodevalue
        Case "enclosure" : enclosure  = objNode2.attributes.GetNamedItem("url").Text
      End Select
    Next
    'Response.Write "<a href='"& guid &"' target='_blank'>"& url &"</a>" & VbCrLf
    'Response.Write "<hr size='1'>" & VbCrLf
    titulo_post = title
    mp3_post = enclosure
  Next
  Set nodeList = Nothing
End If

Set xml = Nothing

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

use childNodes.lenght

ai pode pegar o maior com o ubound().

Share this post


Link to post
Share on other sites
  • 0
use childNodes.lenght

ai pode pegar o maior com o ubound().

onde eu colocaria?

Share this post


Link to post
Share on other sites
  • 0

onde se pega o tamanho da lista

Set nodeList = xml.getElementsByTagName("item")

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  



  • Forum Statistics

    • Total Topics
      148117
    • Total Posts
      643393
×
×
  • Create New...