|
|
|
|
- Presentación
- ¿Cómo proceder?
- Creación de un flujo RSS
- Ejemplos
WINDEV, WEBDEV y WINDEV Mobile le permiten producir y/o consumir un feed RSS (Rapid Simple Syndication). Un canal RSS se utiliza para producir (poner a disposición) un flujo de datos en formato estándar. Este flujo de datos puede ser leído (consumido) por una aplicación. Un lector de feeds RSS sirve para visualizar uno o varios feeds RSS. Creación de un flujo RSS Para crear un canal RSS: - Declarar las variables rssStream, rssChannel y rssEntry.
- Describe el canal con las propiedades de rssChannel.
- Describa las entradas con las propiedades de rssEntry.
- Añada el canal y luego sus entradas en el flujo.
Observaciones: - Un arroyo está hecho de canales. Un canal se compone de entradas.
- Le recomendamos que utilice funciones como añadir, Eliminar, ... para manipular el array de las entradas y el array de los canales.
Ejemplos Ejemplo de creación de un canal RSS: MyStream is rssStream MyChannel is rssChannel MyEntry is rssEntry MyPath is string // Characteristics of channel MyChannel.Title = "My site" MyChannel.Description = "Example of RSS 2.0 stream" MyChannel.UpdateDate = DateSys() + TimeSys() MyChannel.Link = "http://www.example.org" // Characteristics of entries of channel 1 MyEntry.Author = "pcsoft@pcsoft.fr" MyEntry.Description = "First news" MyEntry.Title = "News #1" // Adds the entry into the channel Add(MyChannel.Entry, MyEntry) // Adds the channel into the stream Add(MyStream.Channel, MyChannel) // Saves the stream in a file MyPath = CompleteDir(fCurrentDir()) + "Rss.xml" rssSave(MyStream, MyPath) // Displays the XML file of stream IF NOT ShellExecute(MyPath) THEN Error("ShellExecute('" + MyPath + "'). '" + ErrorInfo() + "'") END
Atención: En este ejemplo, las adiciones realizadas por añadir deben realizarse en último lugar para manipular el elemento solicitado. También tiene la posibilidad de utilizar el siguiente código: MyStream is rssStream ChannelNum is int EntryNum is int MyPath is string MyPath = CompleteDir(fCurrentDir()) + "Rss.xml" // Describe and add the channel ChannelNum = 1 ChannelNum = Add(MyStream.Channel) MyStream.Channel[ChannelNum].Title = "My site" MyStream.Channel[ChannelNum].Description = "Example of RSS 2.0 stream" MyStream.Channel[ChannelNum].PublicationDate = Today() MyStream.Channel[ChannelNum].Link = "http://www.example.org" // Describe and add the entry 1 EntryNum = Add(MyStream.Channel[ChannelNum].Entry) MyStream.Channel[ChannelNum].Entry[EntryNum].Title = "First news" MyStream.Channel[ChannelNum].Entry[EntryNum].Description = "News #1" MyStream.Channel[ChannelNum].Entry[EntryNum].Link = "http://www.example.org" MyStream.Channel[ChannelNum].Entry[EntryNum].PublicationDate = Today() EntryNum = Add(MyStream.Channel[ChannelNum].Entry) // Describe and add the next entry MyEntry is rssEntry dynamic = MyStream.Channel[ChannelNum].Entry[EntryNum] MyEntry.Title = "Second news" MyEntry.Description = "News #2" MyEntry.Link = "http://www.example.org" MyEntry.PublicationDate = Today() // Saves the stream in a file rssSave(MyStream, MyPath) // Displays the XML file of stream IF NOT ShellExecute(MyPath) THEN Error("ShellExecute('" + MyPath + "'). '" + ErrorInfo() + "'") END
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|