Old 29th March 2007, 17:11   #1
ChrisMorton75
Junior Member
 
Join Date: Mar 2007
Location: texas
Posts: 16
Unhappy ${xml::FindNextElement}

I'm trying to pull values from one xml file and insert them in another. It works as long as all the elements exist in the file.

Here's the snippet (after the file is loaded)

;-----------------------------------------------------------
; Go to the root xml element
${xml::RootElement} $0 $1

; Initialize text
StrCpy $userid_text ""

; find (go to) the element
${xml::FindNextElement} "userid" $0 $1

; If can't find the element, skip reading the text
StrCmp $1 "0" 0 +2

; Read this element's text
${xml::GetText} $userid_text $1

${xml::FindCloseElement}
;-----------------------------------------------------------
;-----------------------------------------------------------
; Go to the root xml element
${xml::RootElement} $0 $1

; Initialize text
StrCpy $url_text ""

; find (go to) the element
${xml::FindNextElement} "url" $0 $1

; If can't find the element, skip reading the text
StrCmp $1 "0" 0 +2

; Read this element's text
${xml::GetText} $url_text $1

${xml::FindCloseElement}


Here's the problem - to make sure it works if ELEMENTS are missing, I replaced the "userid" with "unknown". It fails and behaves the way you'd expect. Then I up back "userid" and go to the next section and replace "url" with "unknown"
I get a microsoft error "... has encountered a problem and must close down"

This looks like a bug to me (first section works with missing element, 2nd section doesn't).

Is there something I need to do between each section to avoid this error?
ChrisMorton75 is offline   Reply With Quote
Old 29th March 2007, 17:59   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Maybe the xml is bad formatted?


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 29th March 2007, 18:12   #3
ChrisMorton75
Junior Member
 
Join Date: Mar 2007
Location: texas
Posts: 16
An XML editor isn't complaining about it so I have to assume it is OK.
ChrisMorton75 is offline   Reply With Quote
Old 8th April 2008, 12:20   #4
MP_chefkoch
Junior Member
 
Join Date: Jul 2004
Posts: 7
Hi i am trying to read an xml file, too.
For me it is working but, many users gets the same error, maybe you can help me to find the issue?

here is the script/code i use:
http://mediaportal.svn.sourceforge.n...sh?view=markup

here are two possible xmls which are read
#1: http://mediaportal.svn.sourceforge.n...ml?view=markup
#2: http://mediaportal.svn.sourceforge.n...ml?view=markup


thx
regards
chefkoch
MP_chefkoch is offline   Reply With Quote
Old 9th April 2008, 06:43   #5
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
code:
StrCmp $1 "0" 0 +2
${xml::GetText} $userid_text $1

${xml::GetText} is a macro you can't use relative jumps over it.
Instructor is offline   Reply With Quote
Old 9th April 2008, 13:56   #6
ChrisMorton75
Junior Member
 
Join Date: Mar 2007
Location: texas
Posts: 16
Thank you for the explanation about macros and relative jumps. I put labels on my jumps because I couldn't trust the relative jumps but didn't know why!
ChrisMorton75 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump