Author: mrglavas
Date: Sat Jul 7 22:56:29 2012
New Revision: 1358665
URL: http://svn.apache.org/viewvc?rev=1358665&view=rev
Log:
Use SAX2 APIs in samples. SAX1 is deprecated.
Modified:
xerces/java/trunk/samples/socket/KeepSocketOpen.java
Modified: xerces/java/trunk/samples/socket/KeepSocketOpen.java
URL:
http://svn.apache.org/viewvc/xerces/java/trunk/samples/socket/KeepSocketOpen.java?rev=1358665&r1=1358664&r2=1358665&view=diff
==============================================================================
--- xerces/java/trunk/samples/socket/KeepSocketOpen.java (original)
+++ xerces/java/trunk/samples/socket/KeepSocketOpen.java Sat Jul 7 22:56:29
2012
@@ -28,11 +28,11 @@ import java.net.Socket;
import java.util.Random;
import org.apache.xerces.parsers.SAXParser;
-import org.xml.sax.AttributeList;
-import org.xml.sax.HandlerBase;
+import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
import socket.io.WrappedInputStream;
import socket.io.WrappedOutputStream;
@@ -245,7 +245,7 @@ public class KeepSocketOpen {
* @author Andy Clark, IBM
*/
public static final class Client
- extends HandlerBase
+ extends DefaultHandler
implements Runnable {
//
@@ -295,7 +295,7 @@ public class KeepSocketOpen {
public Client(String address, int port) throws IOException {
this(address, port, false);
fParser = new SAXParser();
- fParser.setDocumentHandler(this);
+ fParser.setContentHandler(this);
fParser.setErrorHandler(this);
}
@@ -358,7 +358,7 @@ public class KeepSocketOpen {
} // run()
//
- // DocumentHandler methods
+ // ContentHandler methods
//
/** Start document. */
@@ -371,18 +371,18 @@ public class KeepSocketOpen {
} // startDocument()
/** Start element. */
- public void startElement(String name, AttributeList attrs) {
+ public void startElement(String uri, String localName, String qName,
Attributes atts) {
fElementCount++;
- fAttributeCount += attrs != null ? attrs.getLength() : 0;
- } // startElement(String,AttributeList)
+ fAttributeCount += atts != null ? atts.getLength() : 0;
+ } // startElement(String,String,String,Attributes)
/** Ignorable whitespace. */
- public void ignorableWhitespace(char[] ch, int offset, int length) {
+ public void ignorableWhitespace(char[] ch, int start, int length) {
fIgnorableWhitespaceCount += length;
} // ignorableWhitespace(char[],int,int)
/** Characters. */
- public void characters(char[] ch, int offset, int length) {
+ public void characters(char[] ch, int start, int length) {
fCharactersCount += length;
} // characters(char[],int,int)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]