Jump to content

XML Com Help


Recommended Posts

Hey guys, I've been trying to get this to work for a while now

This is my script and the xml, please let me know what I'm doing wrong here. I think its the format of the xml that gives me an error of -1

Thanks in advance

#include "_XMLDomWrapper.au3"
$xml = _XMLFileOpen( @ScriptDir&"\savage garden.xml" )
$node = _XMLGetValue("//playlist/trackList/track/location[1]")
ConsoleWrite($node)

<playlist version="1" start="0" end="9" total="142" prev="None" next="10">
<title><title/>
<trackList>
<track>
<location>
http://espanol.geocities.com/neto3033/mp3/Savage_Garden_-_Break_me_shake_me.mp3
</location>
<title>Break Me Shake Me</title>
<creator>Savage Garden</creator>
<album>Savage Garden</album>
<genre>Pop</genre>
<composer/>
ETC...

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Hey guys, I've been trying to get this to work for a while now

This is my script and the xml, please let me know what I'm doing wrong here. I think its the format of the xml that gives me an error of -1

Thanks in advance

#include "_XMLDomWrapper.au3"
$xml = _XMLFileOpen( @ScriptDir&"\savage garden.xml" )
$node = _XMLGetValue("//playlist/trackList/track/location[1]")
ConsoleWrite($node)

<playlist version="1" start="0" end="9" total="142" prev="None" next="10">
<title><title/>
<trackList>
<track>
<location>
http://espanol.geocities.com/neto3033/mp3/Savage_Garden_-_Break_me_shake_me.mp3
</location>
<title>Break Me Shake Me</title>
<creator>Savage Garden</creator>
<album>Savage Garden</album>
<genre>Pop</genre>
<composer/>
ETC...
Maybe <title><title/> should be <title></title>? Or for empty node you may use <title/> alone instead.
Link to comment
Share on other sites

Maybe <title><title/> should be <title></title>? Or for empty node you may use <title/> alone instead.

Well take a look at the API call from this site.

http://www.seeqpod.com/api/v0.2/c8fb8383e0...madly%20deeply/

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Well take a look at the API call from this site.

http://www.seeqpod.com/api/v0.2/c8fb8383e0...madly%20deeply/

Guess you want get location of first track found. For this I think more correct will be xpath "//playlist/trackList/track[0]/location".

But this doesn't work with XMLWrapper either, though this code work fine:

$oXml = ObjCreate("Msxml2.DOMDocument")
$oXml.Load(@ScriptDir&"\savage garden.xml")

$oNodeList = $oXml.documentElement.selectNodes("//playlist/trackList/track[0]/location")
For $oNode In $oNodeList
    ConsoleWrite($oNode.Text & @CRLF)
Next

Probably a bug in the XMLWrapper?

Link to comment
Share on other sites

Hi, There are two things needing amending.

1.- Like Lazycat said should be </title> in the xml file. About the example at http://www.seeqpod.com/api/v0.2 should be noted that it is <title/> like short notation of <title></title>. Also it can be just only <title/>, that is deleting <title> in xml file.

2.- At code example, should be ConsoleWrite($node[1]) instead of ConsoleWrite($node).

Regards,

Eduardo.

Link to comment
Share on other sites

Thanks guys. I found out what was the problem. It was the: xmlns="http://xspf.org/ns/0/"

So after using

$string = StringReplace( $string, ' xmlns="http://xspf.org/ns/0/" ', '' )

everything works just fine.

Thanks again

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

  • 10 months later...

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...