Read XML from Socket with socket\


How to read XML document from socket connections with the socket\ provided in the Apache Xerces package?

✍: FYIcenter


If you want to see how XML parser handles XML document from socket connections, you can try the socket\ provided in the Apache Xerces package to display element type information.

Compile and run socket\, if you have Apache Xerces 2.11.0 installed:

\fyicenter\xerces-2_11_0\samples>\fyicenter\jdk-1.8.0\bin\javac socket\
Note: socket\ uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

   -cp .;..\xercesImpl.jar socket.DelayedInput User.xml
# filename: User.xml
read 48 bytes in 23 ms: [\n<!-- Copyright (c) 2017 -->\n<User]
read 48 bytes in 968 ms: [>\n    <ID>101</ID>\n    <BirthDate>1970-01-01+00:]
read 48 bytes in 682 ms: [01</BirthDate>\n    <Name>Frank Y. Ivy</Name>\n   ]
read 27 bytes in 1988 ms: [ <Sex>  Male</Sex>\n</User>\n]
read -1 bytes in 1977 ms: no data read


Using Apache Xerces Socket Sample Programs

⇒⇒FAQ for Apache Xerces XML Parser

2017-09-28, 299👍, 0💬