Reputation: 56699
How do the SAX API-s validate XML against a schema/DTD?
My understanding is the SAX API-s read an XML doc chuck by chunk and do not store the previously read chunks in memory. So I'm not clear how the API could validate the doc without keeping it all in memory. ??
Upvotes: 0
Views: 605
Reputation: 20683
You don't need to keep the whole XML tree in memory in order to validate it. Just those parts that are validated at the moment are needed to be in memory. For example, if you need to confirm to structure like that root/child*/property*, then only child-parent relationships are actually needed to be checked and thus we need to store only previous element to verify that. Of course, if sturucture is more complex, than more memory will be used to verify complex constraints.
Upvotes: 1