Read XML from Socket with socket\DelayedInput.java

Q

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

✍: FYIcenter

A

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

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

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

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

 

Read XML/DTD from Socket with socket\DelayedInput.java

socket\DelayedInput.java - Apache Xerves Socket Sample

Using Apache Xerces Socket Sample Programs

⇑⇑ FAQ for Apache Xerces XML Parser

2017-09-28, 63899🔥, 0💬