一般来说,作为 android 和 java 的新手,我一直在努力从开放的网络套接字解析 xml。
情况如下:-
我连接到一个服务器,该服务器根据特定事件提供 xml 标签。客户端(android)需要连接到服务器并在服务器发送标签时解析标签。任何标签后都没有 EOL。套接字需要保持打开状态。
问题是 SAX 在套接字关闭之前不会尝试解析 xml。
我查了资料没有结果。
任何指向示例代码的指针将不胜感激。
Being new to android and java in general, I have been struggling with parsing xml from an open network socket.
The senario is as follows :-
I connect to a server that servers xml tags based on specific events. The client (android) needs to connect to the server and parse the tags as the server sends them. There is no EOL after any tags. The socket needs to remain open.
The problem is that SAX does not try to parse the xml until the socket has been closed.
I have searched from information to no avail.
Any pointers to example code would be much appreciated.
发布评论
评论(1)
尝试使用拉解析器?
http://developer.android.com/reference/org/xmlpull/v1 /XmlPullParser.html
Try using a pull parser?
http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html