${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?