UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

ReadXMLData Syntax ReadXMLData(xml_data_handle, rec) Note: This function is case-sensitive. If you want it to be case-insensitive, you must compile your programs using the BASIC command with the -i option. Description After opening the XML document with the OpenXMLData function, read the document using the ReadXMLData function. UniBASIC returns the XML data as a dynamic array. Syntax The following table describes each parameter of the syntax. Parameter Description After you read the XML document, you can execute any UniBASIC statement or function against the data. 1-660 UniBasic Commands Reference xml_data_handle A variable that holds the XML data handle created by the OpenXMLData function. rec A mark-delimited dynamic array containing the extracted data. ReadXMLData Parameters

Status Codes The status code can be one of the following: Status Code Description XML.SUCCESS Success XML.ERROR Failure XML.INVALID.HANDLE Invalid xml_data_handle XML.EOF End of data ReadXMLData Status Codes Example The following example illustrates use of the ReadXMLData function: MOREDATA=1 LOOP WHILE (MOREDATA=1) status = ReadXMLData(STUDENT_XML,rec) IF status = XML.ERROR THEN STOP “Error when preparing the XML document. “ END ELSE IF status = XML.EOF THEN PRINT “No more data” MOREDATA = 0 END ELSE PRINT “rec = “:rec END REPEAT ReadXMLData 1-661

Status Codes<br />

The status code can be one of the following:<br />

Status Code Description<br />

XML.SUCCESS Success<br />

XML.ERROR Failure<br />

XML.INVALID.HANDLE Invalid xml_data_handle<br />

XML.EOF End of data<br />

ReadXMLData Status Codes<br />

Example<br />

The following example illustrates use of the ReadXMLData function:<br />

MOREDATA=1<br />

LOOP WHILE (MOREDATA=1)<br />

status = ReadXMLData(STUDENT_XML,rec)<br />

IF status = XML.ERROR THEN<br />

STOP “Error when preparing the XML document. “<br />

END ELSE IF status = XML.EOF THEN<br />

PRINT “No more data”<br />

MOREDATA = 0<br />

END ELSE<br />

PRINT “rec = “:rec<br />

END<br />

REPEAT<br />

ReadXMLData 1-661

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!