ConsultingJoe Posted November 1, 2007 Posted November 1, 2007 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... Check out ConsultingJoe.com
Lazycat Posted November 2, 2007 Posted November 2, 2007 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. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
ConsultingJoe Posted November 2, 2007 Author Posted November 2, 2007 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/ Check out ConsultingJoe.com
Lazycat Posted November 2, 2007 Posted November 2, 2007 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? Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
Eduardo Posted November 2, 2007 Posted November 2, 2007 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.
ConsultingJoe Posted November 2, 2007 Author Posted November 2, 2007 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 Check out ConsultingJoe.com
leevy Posted September 9, 2008 Posted September 9, 2008 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 I have the same question now, can you post your whole solution? thanks
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now