ContendHandler is not thread safe and reentrant.
Whereas it's straightforward to design SAX program that operates multiple documents in series, it is almost impossible to design one to operate mulitple documents in parallel.
[1] If you need to perform. XML parsing in multiple documents, simultaneous threads, give each thread its own XMLReader and ContentHandler objects.
[2] If you want to parse another document inside one o the ContentHandler methods, you need to create a new XMLReader and ContentHandler objects to parse it.
[3] Don't try to use the existing XMLReader and ContentHandler object before they have finished with the current document.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8585387/viewspace-220363/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8585387/viewspace-220363/