Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 3.0 (http://www.flasher.ru/forum/forumdisplay.php?f=83)
-   -   XML parse (http://www.flasher.ru/forum/showthread.php?t=112478)

telit 29.05.2008 02:06

XML parse
 
такой вопрос:
Код:

trace(entry.xml.toString());
выдает такое:
Код:

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:rte="http://www.rte.ie/schemas/vod">
  <id>http://vod.rte.ie/videos/4rnGcQpDcyc</id>
  <published>2008-02-21T07:56:58.000-08:00</published>
  <updated>2008-04-30T07:06:00.000-07:00</updated>
  <title type="text">Fair City</title>
  <content type="text">Ali and Robin have a huge row front of the whole street. Jimmy can’t handle it and walks off but neither of them notices as they are still arguing. McAleer gives Tiernan and envelope containing a copy of Benjamin’s birth certificate.</content>
  <category term="channel" label="RTE One"/>
  <category term="genre" label="Drama"/>
  <category term="series" label="Season 25"/>
  <link rel="self" type="application/atom+xml" href="http://vod.rte.ie/videos/4rnGcQpDcyc"/>
  <link rel="alternate" type="text/html" href="http://vod.rte.ie/app?id=4rnGcQpDcyc"/>
  <link rel="embed" type="application/x-shockwave-flash" href="http://vod.rte.ie/player?id=4rnGcQpDcyc"/>
  <rte:valid start="2008-04-30T07:06:00.000-07:00" end="2008-04-30T07:06:00.000-07:00"/>
  <rte:duration ms="1234000" formatted="00:12"/>
  <rte:statistics views="1282"/>
  <author>
    <name>RTE</name>
    <uri>http://www.rte.ie</uri>
  </author>
  <media:title type="plain">Fair City</media:title>
  <media:description type="plain">Ali and Robin have a huge row front of the whole street. Jimmy can’t handle it and walks off but neither of them notices as they are still arguing. McAleer gives Tiernan and envelope containing a copy of Benjamin’s birth certificate.</media:description>
  <media:player url="http://vod.rte.ie/player?id=4rnGcQpDcyc" width="400" height="300"/>
  <media:thumbnail url="http://dynamic.rte.ie/09786756.jpg" height="128" width="72" time="00:00:00.000"/>
  <media:restriction relationship="allow" type="country">ie gb</media:restriction>
  <media:rating>ma</media:rating>
  <media:group>
    <media:content url="rtmp://rtmp.rte.ie/vod/file1.mp4" type="video/mp4" medium="video" expression="full" duration="15000" rte:format="advertising"/>
    <media:content url="rtmp://rtmp.rte.ie/vod/file2.mp4" type="video/mp4" medium="video" expression="full" duration="5000" rte:format="sting"/>
    <media:content url="rtmp://rtmp.rte.ie/vod/file3.mp4" type="video/mp4" medium="video" expression="full" duration="1800000" rte:format="content"/>
    <media:content url="rtmp://rtmp.rte.ie/vod/file4.mp4" type="video/mp4" medium="video" expression="full" duration="15000" rte:format="advertising"/>
    <media:content url="rtmp://rtmp.rte.ie/vod/fil6e.mp4" type="video/mp4" medium="video" expression="full" duration="1800000" rte:format="content"/>
  </media:group>
</entry>

Как получить массив "media:group"?

Skriv 29.05.2008 08:54

Код:

trace(entry.media:group.text());

telit 30.05.2008 10:46

Спасибо! Возник ещё один вопрос как получить доступ к такому аттрибуту:
Код:

rte:format="advertising"

etc 30.05.2008 20:55

telit, вам привели синтаксически неверный код, у вас он что, работает?

vooparker 31.05.2008 10:51

это особый, уличный код =)
2tellit: на вскидку, попробуй так
Код:

var media:Namespace = new Namespace("http://search.yahoo.com/mrss/");
var rte:Namespace = new Namespace("http://www.rte.ie/schemas/vod");
trace(entry.xml.media::group.*);
trace(entry.xml.media::group.media::content[0].@rte::format);


telit 08.06.2008 12:42

Спасибо. Получилось, но появилась другая проблема
как вытащить "href" из
Код:

<link...

etc 08.06.2008 13:51

@href

telit 09.06.2008 02:31

Код:

<link rel="self" type="application/atom+xml" href="http://vod.rte.ie/videos/4rnGcQpDcyc"/>
  <link rel="alternate" type="text/html" href="http://vod.rte.ie/app?id=4rnGcQpDcyc"/>
  <link rel="embed" type="application/x-shockwave-flash" href="http://vod.rte.ie/player?id=4rnGcQpDcyc"/>

как обратиться к 1,2 и 3 "link"?
XML представлен в начале темы.

vooparker 09.06.2008 03:01

ну может уже справочник откроете? http://livedocs.adobe.com/flex/3/htm...th_XML_01.html

telit 09.06.2008 11:34

Код:

for each (var prop:XML in entry.xml.link)
                                                {
                                                        trace(prop);
                                                }

Пробовал разобраться, не получается :(


Часовой пояс GMT +4, время: 18:19.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.