I am using PB CC 4.0.4.0042. I have a sample below of a program that I am writing that demonstrates some behavior that I cannot explain. The following is the output when the program is run:
$300,000
<descrip seqnum='1' code='B40'>higher education</descrip>
Applications not accepted.</accepts
The first two line of output matches what I thought I would see. The third line does not. It should read:
Applications not accepted.
Any idea why this behavior is taking place?
$300,000
<descrip seqnum='1' code='B40'>higher education</descrip>
Applications not accepted.</accepts
The first two line of output matches what I thought I would see. The third line does not. It should read:
Applications not accepted.
Any idea why this behavior is taking place?
Code:
#COMPILE EXE #DIM ALL FUNCTION getXMLElementText(BYREF xmlBuffer AS STRING, startNode AS STRING, endNode AS STRING) AS STRING LOCAL startPos& LOCAL endPos& LOCAL nodeAttribute AS STRING LOCAL tempString AS STRING startPos& = INSTR(xmlBuffer, startNode) IF startPos& THEN endPos& = INSTR(xmlBuffer, endNode) IF endPos& THEN FUNCTION = MID$(xmlBuffer, startPos& + LEN(startNode), endPos& - LEN(endNode) - startPos& + 1) END IF END IF END FUNCTION FUNCTION PBMAIN () AS LONG STDOUT getXMLElementText("<total-giving>$300,000</total-giving>", "<total-giving>", "</total-giving>") 'Result is $300,000 STDOUT getXMLElementText("<flds-of-interest><descrip seqnum='1' code='B40'>higher education</descrip></flds-of-interest>", "<flds-of-interest>", "</flds-of-interest>") 'Result <descrip seqnum='1' code='B40'>higher education</descrip> STDOUT getXMLElementText("<accepts-appl code='N'>Applications not accepted.</accepts-appl>", "<accepts-appl code='N'>", "</accepts-appl>") 'Result: Applications not accepted.</accepts END FUNCTION
Comment