Sax character method cutting elements


It's easy to use SAX to parse a xml document. At the end of this article, I'll give a simple example of SAX parsing XML.
But one point, the character method, you can't count on this method to return entire element valuses. Because SAX reads data in a buffer(2048 byte one time, maybe we can set the length somewhere), and if it reaches the end of buffer, it will stop to read more byte. So it will read half-baked element value is usual. We have to string together until end element is reached. Because parser doesn't do this for us.

 

For example

發佈了75 篇原創文章 · 獲贊 3 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章