posted 18 years ago
The ideas behind reading and parsing are slightly different. Reading a file simply has the aim of transferring its contents from file into memory. Parsing attempts to find some kind of meaning to the contents of the file. This is why you can read just about any kind of file, but only parse those with a structure that the parser can understand.... like XML!
An analogy would be that photocopying a page from a book would be "reading" it (the contents is accessed and copied), while a human looking at the page and understanding a message written on it would be parsing (by analysing the contents as structured information).
Quite often parsing will return an object that can be manipulated, like when using a DOM parser. Not always though - SAX parsing may not return an object. While it appears to have just "read" the document and not actually returned anything, its still doing some parsing to recognise when it comes across chunks of information such as elements and attributes.
[ December 14, 2005: Message edited by: Dave Lenton ]
There will be glitches in my transition from being a saloon bar sage to a world statesman. - Tony Banks