Removed <nil/>/null support.

Changed default parser from OpenXML to MinML
This commit is contained in:
hns 2001-05-20 13:17:12 +00:00
parent 9e43be37f7
commit 009e1318c3

View file

@ -64,7 +64,6 @@ public abstract class XmlRpc extends HandlerBase {
static final int BASE64 = 5;
static final int STRUCT = 6;
static final int ARRAY = 7;
static final int NIL = 8;
// Error level + message
int errorLevel;
@ -79,7 +78,7 @@ public abstract class XmlRpc extends HandlerBase {
// for debugging output
public static boolean debug = false;
final static String types[] = {"String", "Integer", "Boolean", "Double", "Date", "Base64", "Struct", "Array", "Nil"};
final static String types[] = {"String", "Integer", "Boolean", "Double", "Date", "Base64", "Struct", "Array"};
// mapping between java encoding names and "real" names used in XML prolog.
// if you use an encoding not listed here send feedback to xmlrpc@helma.org
@ -176,7 +175,7 @@ public abstract class XmlRpc extends HandlerBase {
long now = System.currentTimeMillis ();
if (parserClass == null) {
// try to get the name of the SAX driver from the System properties
setDriver (System.getProperty ("sax.driver", "org.openxml.parser.XMLSAXParser"));
setDriver (System.getProperty ("sax.driver", "uk.co.wilson.xml.MinML"));
}
Parser parser = null;
@ -241,10 +240,7 @@ public abstract class XmlRpc extends HandlerBase {
*/
void writeObject (Object what, XmlWriter writer) throws XmlRpcException {
writer.startElement ("value");
if (what == null) {
// try sending experimental <ni/> element
writer.emptyElement ("nil");
} else if (what instanceof String) {
if (what instanceof String) {
writer.chardata (what.toString ());
} else if (what instanceof Integer) {
writer.startElement ("int");
@ -294,8 +290,11 @@ public abstract class XmlRpc extends HandlerBase {
}
}
writer.endElement ("struct");
} else
} else if (what == null) {
throw new XmlRpcException (0, "null is not supported as parameter in XML-RPC.");
} else {
throw new XmlRpcException (0, "Java class not supported in XML-RPC: " + what.getClass ());
}
writer.endElement ("value");
}
@ -421,8 +420,6 @@ public abstract class XmlRpc extends HandlerBase {
currentValue.setType (STRUCT);
else if ("array".equals (name))
currentValue.setType (ARRAY);
else if ("nil".equals (name))
currentValue.setType (NIL);
}
@ -593,6 +590,10 @@ public abstract class XmlRpc extends HandlerBase {
buf.append (text);
}
public void write (char c) {
buf.append (c);
}
public String toString () {
return buf.toString ();
}