Jump to content

I need help with _XMLDomWrapper x3


Recommended Posts

How would I go about getting using _XMLDomWrapper.au3 to get an array containing the channel URL for each of the channels in the XML file? I've never used XML before so I have no clue what I'm doing, any help would be greatly appreciated.

XML File:

<?xml version="1.0" encoding="UTF-8"?>
<channels>
  <channel>
    <category>gaming</category>
    <id>4870636</id>
    <login>total_cereal</login>
    <subcategory>wii</subcategory>
    <title>Total Cereal's Box</title>
    <status>Donkey Kong Country Returns</status>
    <tags>0 1 2 3 4 5 6 7 8 9 and box brawl cereal cereals cerealsgameboy galaxy gamecube gba gcn kart majoras mario mask metroid nintendo ocarina of pokemon the time total wii zelda</tags>
    <producer>true</producer>
    <category_title>Gaming</category_title>
    <subcategory_title>Wii</subcategory_title>
    <producer>true</producer>
    <language>en</language>
    <timezone>US/Eastern</timezone>
    <channel_url>http://www.justin.tv/total_cereal</channel_url>
    <mature nil="true"></mature>
    <image_url_huge>http://static-cdn.jtvnw.net/jtv_user_pictures/total_cereal-profile_image-8f140eab3c7dc386-600x600.jpeg</image_url_huge>
    <image_url_large>http://static-cdn.jtvnw.net/jtv_user_pictures/total_cereal-profile_image-8f140eab3c7dc386-300x300.jpeg</image_url_large>
    <image_url_medium>http://static-cdn.jtvnw.net/jtv_user_pictures/total_cereal-profile_image-8f140eab3c7dc386-150x150.jpeg</image_url_medium>
    <image_url_small>http://static-cdn.jtvnw.net/jtv_user_pictures/total_cereal-profile_image-8f140eab3c7dc386-70x70.jpeg</image_url_small>
    <image_url_tiny>http://static-cdn.jtvnw.net/jtv_user_pictures/total_cereal-profile_image-8f140eab3c7dc386-50x50.jpeg</image_url_tiny>
    <screen_cap_url_huge>http://static-cdn.jtvnw.net/previews/live_user_total_cereal-630x473.jpg</screen_cap_url_huge>
    <screen_cap_url_large>http://static-cdn.jtvnw.net/previews/live_user_total_cereal-320x240.jpg</screen_cap_url_large>
    <screen_cap_url_medium>http://static-cdn.jtvnw.net/previews/live_user_total_cereal-150x113.jpg</screen_cap_url_medium>
    <screen_cap_url_small>http://static-cdn.jtvnw.net/previews/live_user_total_cereal-70x53.jpg</screen_cap_url_small>
    <embed_enabled>true</embed_enabled>
    <embed_code>    &lt;object type=&quot;application/x-shockwave-flash&quot; height=&quot;295&quot; width=&quot;353&quot; id=&quot;live_embed_player_flash&quot; data=&quot;http://www.justin.tv/widgets/live_embed_player.swf?channel=total_cereal&quot; bgcolor=&quot;#000000&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.justin.tv/widgets/live_embed_player.swf&quot; /&gt;&lt;param name=&quot;flashvars&quot; value=&quot;start_volume=25&amp;watermark_position=top_right&amp;channel=total_cereal&amp;auto_play=false&quot; /&gt;&lt;/object&gt;
</embed_code>
    <views_count>#&lt;TwiceNumber:0xbab3988&gt;</views_count>
  </channel>
  <channel>
    <category>gaming</category>
    <id>5037326</id>
    <login>blackhawk88</login>
    <subcategory>xbox</subcategory>
    <title>CC Blackhawk's Underground Station </title>
    <status> Black Ops w/ Blackhawk</status>
    <tags>0 1 10 100 2 3 360 4 5 6 7 8 88 9 a amazing arcade b ball band bass best black blackhawk borderlands box burst c call cc ccblack ccblackhawk combo cry d dbz dirt dirt2 dragon drifting drum drums duty e expert f far fc full fullcombo funny g gh gh5 ghm ghwt god good guitar h halen halo hawk hero high i j k l limit live m metallica modern music n o oblivion of ox p pa philadelphia philly pro q quality r s sexy t tour u v van vh vocals vs w warfare</tags>
    <producer>true</producer>
    <category_title>Gaming</category_title>
    <subcategory_title>Xbox</subcategory_title>
    <producer>true</producer>
    <language>en</language>
    <timezone>America/New_York</timezone>
    <channel_url>http://www.justin.tv/blackhawk88</channel_url>
    <mature>true</mature>
    <image_url_huge>http://static-cdn.jtvnw.net/jtv_user_pictures/blackhawk88-profile_image-3c6202c409f9421f-600x600.jpeg</image_url_huge>
    <image_url_large>http://static-cdn.jtvnw.net/jtv_user_pictures/blackhawk88-profile_image-3c6202c409f9421f-300x300.jpeg</image_url_large>
    <image_url_medium>http://static-cdn.jtvnw.net/jtv_user_pictures/blackhawk88-profile_image-3c6202c409f9421f-150x150.jpeg</image_url_medium>
    <image_url_small>http://static-cdn.jtvnw.net/jtv_user_pictures/blackhawk88-profile_image-3c6202c409f9421f-70x70.jpeg</image_url_small>
    <image_url_tiny>http://static-cdn.jtvnw.net/jtv_user_pictures/blackhawk88-profile_image-3c6202c409f9421f-50x50.jpeg</image_url_tiny>
    <screen_cap_url_huge>http://static-cdn.jtvnw.net/previews/live_user_blackhawk88-630x473.jpg</screen_cap_url_huge>
    <screen_cap_url_large>http://static-cdn.jtvnw.net/previews/live_user_blackhawk88-320x240.jpg</screen_cap_url_large>
    <screen_cap_url_medium>http://static-cdn.jtvnw.net/previews/live_user_blackhawk88-150x113.jpg</screen_cap_url_medium>
    <screen_cap_url_small>http://static-cdn.jtvnw.net/previews/live_user_blackhawk88-70x53.jpg</screen_cap_url_small>
    <embed_enabled>true</embed_enabled>
    <embed_code>    &lt;object type=&quot;application/x-shockwave-flash&quot; height=&quot;295&quot; width=&quot;353&quot; id=&quot;live_embed_player_flash&quot; data=&quot;http://www.justin.tv/widgets/live_embed_player.swf?channel=blackhawk88&quot; bgcolor=&quot;#000000&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.justin.tv/widgets/live_embed_player.swf&quot; /&gt;&lt;param name=&quot;flashvars&quot; value=&quot;start_volume=25&amp;watermark_position=top_right&amp;channel=blackhawk88&amp;auto_play=false&quot; /&gt;&lt;/object&gt;
</embed_code>
    <views_count>#&lt;TwiceNumber:0xb9b06d0&gt;</views_count>
  </channel>
  <channel>
    <category>gaming</category>
    <id>8221220</id>
    <login>jaieazy</login>
    <subcategory>shooters</subcategory>
    <title>The People's Station</title>
    <status>MW2 Replay</status>
    <tags>2 bad barber battlefield bfbc call company deathmatch domination duty gears headquarters hq modern mw2 of radio shop show sports sportstalk talk team television war warfare</tags>
    <producer>true</producer>
    <category_title>Gaming</category_title>
    <subcategory_title>Shooters</subcategory_title>
    <producer>true</producer>
    <language>en</language>
    <timezone>America/Los_Angeles</timezone>
    <channel_url>http://www.justin.tv/jaieazy</channel_url>
    <mature>true</mature>
    <image_url_huge>http://static-cdn.jtvnw.net/jtv_user_pictures/jaieazy-profile_image-3d635bc78483f42c-600x600.jpeg</image_url_huge>
    <image_url_large>http://static-cdn.jtvnw.net/jtv_user_pictures/jaieazy-profile_image-3d635bc78483f42c-300x300.jpeg</image_url_large>
    <image_url_medium>http://static-cdn.jtvnw.net/jtv_user_pictures/jaieazy-profile_image-3d635bc78483f42c-150x150.jpeg</image_url_medium>
    <image_url_small>http://static-cdn.jtvnw.net/jtv_user_pictures/jaieazy-profile_image-3d635bc78483f42c-70x70.jpeg</image_url_small>
    <image_url_tiny>http://static-cdn.jtvnw.net/jtv_user_pictures/jaieazy-profile_image-3d635bc78483f42c-50x50.jpeg</image_url_tiny>
    <screen_cap_url_huge>http://static-cdn.jtvnw.net/previews/live_user_jaieazy-630x473.jpg</screen_cap_url_huge>
    <screen_cap_url_large>http://static-cdn.jtvnw.net/previews/live_user_jaieazy-320x240.jpg</screen_cap_url_large>
    <screen_cap_url_medium>http://static-cdn.jtvnw.net/previews/live_user_jaieazy-150x113.jpg</screen_cap_url_medium>
    <screen_cap_url_small>http://static-cdn.jtvnw.net/previews/live_user_jaieazy-70x53.jpg</screen_cap_url_small>
    <embed_enabled>true</embed_enabled>
    <embed_code>    &lt;object type=&quot;application/x-shockwave-flash&quot; height=&quot;295&quot; width=&quot;353&quot; id=&quot;live_embed_player_flash&quot; data=&quot;http://www.justin.tv/widgets/live_embed_player.swf?channel=jaieazy&quot; bgcolor=&quot;#000000&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.justin.tv/widgets/live_embed_player.swf&quot; /&gt;&lt;param name=&quot;flashvars&quot; value=&quot;start_volume=25&amp;watermark_position=top_right&amp;channel=jaieazy&amp;auto_play=false&quot; /&gt;&lt;/object&gt;
</embed_code>
    <views_count>#&lt;TwiceNumber:0xb979158&gt;</views_count>
  </channel>
  <channel>
    <category>gaming</category>
    <id>9378736</id>
    <login>deathhand2277</login>
    <subcategory>other_gaming</subcategory>
    <title>Gaming with Death</title>
    <status>Dead Space &quot;Impossible mode&quot; with No Upgrades/No suit upgrades with Commentary! Let's bring out some rage &lt;o.o&lt;</status>
    <tags></tags>
    <producer>true</producer>
    <category_title>Gaming</category_title>
    <subcategory_title>Other Gaming</subcategory_title>
    <producer>true</producer>
    <language>en</language>
    <timezone>America/New_York</timezone>
    <channel_url>http://www.justin.tv/deathhand2277</channel_url>
    <mature>true</mature>
    <image_url_huge>http://static-cdn.jtvnw.net/jtv_user_pictures/deathhand2277-profile_image-6989ac05d234f0a5-600x600.jpeg</image_url_huge>
    <image_url_large>http://static-cdn.jtvnw.net/jtv_user_pictures/deathhand2277-profile_image-6989ac05d234f0a5-300x300.jpeg</image_url_large>
    <image_url_medium>http://static-cdn.jtvnw.net/jtv_user_pictures/deathhand2277-profile_image-6989ac05d234f0a5-150x150.jpeg</image_url_medium>
    <image_url_small>http://static-cdn.jtvnw.net/jtv_user_pictures/deathhand2277-profile_image-6989ac05d234f0a5-70x70.jpeg</image_url_small>
    <image_url_tiny>http://static-cdn.jtvnw.net/jtv_user_pictures/deathhand2277-profile_image-6989ac05d234f0a5-50x50.jpeg</image_url_tiny>
    <screen_cap_url_huge>http://static-cdn.jtvnw.net/previews/live_user_deathhand2277-630x473.jpg</screen_cap_url_huge>
    <screen_cap_url_large>http://static-cdn.jtvnw.net/previews/live_user_deathhand2277-320x240.jpg</screen_cap_url_large>
    <screen_cap_url_medium>http://static-cdn.jtvnw.net/previews/live_user_deathhand2277-150x113.jpg</screen_cap_url_medium>
    <screen_cap_url_small>http://static-cdn.jtvnw.net/previews/live_user_deathhand2277-70x53.jpg</screen_cap_url_small>
    <embed_enabled>true</embed_enabled>
    <embed_code>    &lt;object type=&quot;application/x-shockwave-flash&quot; height=&quot;295&quot; width=&quot;353&quot; id=&quot;live_embed_player_flash&quot; data=&quot;http://www.justin.tv/widgets/live_embed_player.swf?channel=deathhand2277&quot; bgcolor=&quot;#000000&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.justin.tv/widgets/live_embed_player.swf&quot; /&gt;&lt;param name=&quot;flashvars&quot; value=&quot;start_volume=25&amp;watermark_position=top_right&amp;channel=deathhand2277&amp;auto_play=false&quot; /&gt;&lt;/object&gt;
</embed_code>
    <views_count>#&lt;TwiceNumber:0xb959a88&gt;</views_count>
  </channel>
  <channel>
    <category>gaming</category>
    <id>10092428</id>
    <login>360icons</login>
    <subcategory>xbox</subcategory>
    <title>IcoNs Live</title>
    <status>EU 2v2 Tournament 2PMest/6PMgmt www.360icons.com [FREE Entry]</status>
    <tags>callofduty games modernwarfare2 tournaments videogames xbox</tags>
    <producer>true</producer>
    <category_title>Gaming</category_title>
    <subcategory_title>Xbox</subcategory_title>
    <producer>true</producer>
    <language>en</language>
    <timezone>US/Eastern</timezone>
    <channel_url>http://www.justin.tv/360icons</channel_url>
    <mature>true</mature>
    <image_url_huge>http://static-cdn.jtvnw.net/jtv_user_pictures/360icons-profile_image-7c6ee8165140ae1e-600x600.jpeg</image_url_huge>
    <image_url_large>http://static-cdn.jtvnw.net/jtv_user_pictures/360icons-profile_image-7c6ee8165140ae1e-300x300.jpeg</image_url_large>
    <image_url_medium>http://static-cdn.jtvnw.net/jtv_user_pictures/360icons-profile_image-7c6ee8165140ae1e-150x150.jpeg</image_url_medium>
    <image_url_small>http://static-cdn.jtvnw.net/jtv_user_pictures/360icons-profile_image-7c6ee8165140ae1e-70x70.jpeg</image_url_small>
    <image_url_tiny>http://static-cdn.jtvnw.net/jtv_user_pictures/360icons-profile_image-7c6ee8165140ae1e-50x50.jpeg</image_url_tiny>
    <screen_cap_url_huge>http://static-cdn.jtvnw.net/previews/live_user_360icons-630x473.jpg</screen_cap_url_huge>
    <screen_cap_url_large>http://static-cdn.jtvnw.net/previews/live_user_360icons-320x240.jpg</screen_cap_url_large>
    <screen_cap_url_medium>http://static-cdn.jtvnw.net/previews/live_user_360icons-150x113.jpg</screen_cap_url_medium>
    <screen_cap_url_small>http://static-cdn.jtvnw.net/previews/live_user_360icons-70x53.jpg</screen_cap_url_small>
    <embed_enabled>true</embed_enabled>
    <embed_code>    &lt;object type=&quot;application/x-shockwave-flash&quot; height=&quot;295&quot; width=&quot;353&quot; id=&quot;live_embed_player_flash&quot; data=&quot;http://www.justin.tv/widgets/live_embed_player.swf?channel=360icons&quot; bgcolor=&quot;#000000&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.justin.tv/widgets/live_embed_player.swf&quot; /&gt;&lt;param name=&quot;flashvars&quot; value=&quot;start_volume=25&amp;watermark_position=top_right&amp;channel=360icons&amp;auto_play=false&quot; /&gt;&lt;/object&gt;
</embed_code>
    <views_count>#&lt;TwiceNumber:0xb8d0ff8&gt;</views_count>
  </channel>
</channels>

In the above XML file there are five channels <channel></channel> between the <channels></channels> tags, and I need to get the value between <channel_url></channel_url> tags for each of the channels. I hope I explained my problem clear enough, and again, any help will be greatly appreciated.

Thanks,

- John

Edited by z0mgItsJohn

Latest Projects :- New & Improved TCP Chat

Link to comment
Share on other sites

A whole 45 minutes before bumping :)

#include "_XMLDomWrapper.au3"
#include <array.au3> ;only used for _arrayDisplay

_XMLFileOpen("TV.xml")

$numberOfChannels = _XMLGetNodeCount("/channels/channel")

Local $arrayOfChannels[$numberOfChannels +1]
$arrayOfChannels[0] = $numberOfChannels


For $i = 1 to $numberOfChannels
    $arrayOfChannels[$i] = _XMLGetFirstValue("/channels/channel[" & $i & "]/channel_url")
Next

_ArrayDisplay($arrayOfChannels)





Func _XMLGetFirstValue($node)

    Local $ret_val

    $ret_val = _XMLGetValue($node)
    If IsArray($ret_val) Then
        Return ($ret_val[1])
    Else
        Return SetError(1,3,0)
    EndIf

EndFunc
Link to comment
Share on other sites

  • Developers

Sorry for the bump but someone tripled posted, and there where like 7 posts in front of mine, and I didn't want it to go unseen, I'll test the script later, thanks.

No a good enough reason, so simply be patient ...... :)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 2 months later...

quote name='ChrisL' timestamp='1300085731' post='878023']

A whole 45 minutes before bumping :huh2:

#include "_XMLDomWrapper.au3"
#include <array.au3> ;only used for _arrayDisplay

_XMLFileOpen("TV.xml")

$numberOfChannels = _XMLGetNodeCount("/channels/channel")

Local $arrayOfChannels[$numberOfChannels +1]
$arrayOfChannels[0] = $numberOfChannels


For $i = 1 to $numberOfChannels
    $arrayOfChannels[$i] = _XMLGetFirstValue("/channels/channel[" & $i & "]/channel_url")
Next

_ArrayDisplay($arrayOfChannels)





Func _XMLGetFirstValue($node)

    Local $ret_val

    $ret_val = _XMLGetValue($node)
    If IsArray($ret_val) Then
        Return ($ret_val[1])
    Else
        Return SetError(1,3,0)
    EndIf

EndFunc

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...