java - Parsing xml with StAX: not getting a large content tag -


i using stax parse xml file, problem when tag content large, stax not able give me whole content. here part of xml doc, content of payload tag more larger, can't print in sof:

<payload>{\"id\": \"entity24\",\"attr1\": {\"type\": \"sensor\",\"type\": \"type1\",\"value\": \"val1\",\"metadata\": {}}}</payload> 

here part of code parsing it:

if(startelement.getname().getlocalpart().equals("payload")){     xmlevent = xmleventreader.nextevent();     if(xmlevent.ischaracters()){        setpayload(xmlevent.ascharacters().getdata());                                } } 

any idea why stax not able give whole tag content? , best regards.

you should either concatenate ischaracters events between other events or set is_coalescing property.

just sax, stax may offer 1 single run of characters multiple events.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -