Home > Language Reference > Classes > XmlParser
Parse Method
Starts parsing the document.
Syntax
Public Function Parse(ByRef objData As Stream, Optional ByVal eCharset As HbCharset = hbCharsetUnknown) As Integer
| Parameter | Description |
| objData | XML document to parse. |
| eCharset | Initial encoding scheme. |
Remarks
The Parse method initializes and starts the XML parser. The objData parameter is a data stream containing the document to parse. It can be any data stream as long as it has read permission. You should expect its pointer position to have changed when the function returns. The optional eCharset parameter specifies the encoding scheme of the document, according to the table below:
| Constant | Value | Description |
| hbCharsetUnknown | 0 | Determine automatically (default). |
| hbCharsetUTF8 | 1 | UTF-8 |
| hbCharsetUTF16BE | 2 | UTF-16 Big Endian |
| hbCharsetUTF16LE | 3 | UTF-16 Little Endian |
| hbCharsetLatin1 | 4 | Latin 1, aka ISO 8859-1 |
| hbCharsetLatin9 | 5 | Latin 9, aka ISO 8859-15 |
| hbCharsetWindows1252 | 6 | Windows codepage 1252 |
Usually, you'll specify hbCharsetUnknown for this parameter, so the parser determines automatically the encoding scheme from the byte order mark and the content of the initial <?xml.. ?> tag. As soon as you receive the first StartElement or CharData event, the Charset property reflects the actual encoding scheme of the document.
The document is immediately parsed, which means your code should be ready to process StartElement, EndElement, CharData and ParseError events before this function returns. The Parse function is not reetrant; calling it while processing these events may lead to unpredictable results.
The return value is negative if an unrecoverable error occured or if the Abort function was called. It is zero if the document was successfully parsed. It is positive if the document was successfully parsed but minor errors were encountered, such as unclosed tags.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | N/A |