You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by ha...@apache.org on 2001/11/07 13:41:45 UTC
cvs commit: xml-rpc/src/java/org/apache/xmlrpc XmlRpc.java
hannes 01/11/07 04:41:45
Modified: src/java/org/apache/xmlrpc XmlRpc.java
Log:
* Removed support for nil/null, which is not complient with the XML-RPC spec.
* Switched to MinML as standard parser
* Some minor tweaks and enhancements.
Revision Changes Path
1.3 +12 -12 xml-rpc/src/java/org/apache/xmlrpc/XmlRpc.java
Index: XmlRpc.java
===================================================================
RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpc.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XmlRpc.java 2001/10/29 17:07:05 1.2
+++ XmlRpc.java 2001/11/07 12:41:45 1.3
@@ -76,7 +76,7 @@
public abstract class XmlRpc
extends HandlerBase
{
- public static final String version = "helma XML-RPC 1.0";
+ public static final String version = "Apache XML-RPC 1.0";
String methodName;
@@ -85,6 +85,7 @@
private static Hashtable saxDrivers = new Hashtable ();
static
{
+ saxDrivers.put ("xerces", "org.apache.xerces.parsers.SAXParser");
saxDrivers.put ("xp", "com.jclark.xml.sax.Driver");
saxDrivers.put ("ibm1", "com.ibm.xml.parser.SAXDriver");
saxDrivers.put ("ibm2", "com.ibm.xml.parsers.SAXParser");
@@ -117,7 +118,6 @@
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;
@@ -133,10 +133,9 @@
// for debugging output
public static boolean debug = false;
final static String types[] = {"String", "Integer", "Boolean", "Double",
- "Date", "Base64", "Struct", "Array", "Nil"};
+ "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
static String encoding = "ISO8859_1";
static Properties encodings = new Properties ();
@@ -190,6 +189,9 @@
encoding = enc;
}
+ /**
+ * Return the encoding, transforming to the canonical name if possible.
+ */
public String getEncoding ()
{
return encodings.getProperty (encoding, encoding);
@@ -244,9 +246,10 @@
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", "org.apache.xerces.parsers.SAXParser"));
setDriver (System.getProperty (
- "sax.driver", "org.apache.xerces.parsers.SAXParser"));
+ "sax.driver", "uk.co.wilson.xml.MinML"));
}
Parser parser = null;
@@ -278,8 +281,7 @@
writer.startElement ("value");
if (what == null)
{
- // try sending experimental <ni/> element
- writer.emptyElement ("nil");
+ throw new RuntimeException ("null value not supported by XML-RPC");
}
else if (what instanceof String)
{
@@ -504,8 +506,6 @@
currentValue.setType (STRUCT);
else if ("array".equals (name))
currentValue.setType (ARRAY);
- else if ("nil".equals (name))
- currentValue.setType (NIL);
}
@@ -634,7 +634,7 @@
public XmlWriter (StringBuffer buf)
{
- // The encoding used for XML-RPC is ISO-8859-1 for pragmatical reasons (Frontier/Win).
+ // The default encoding used for XML-RPC is ISO-8859-1 for pragmatical reasons.
this (buf, encoding);
}
@@ -644,7 +644,7 @@
this.enc = enc;
// get name of encoding for XML prolog
String encName = encodings.getProperty (enc, enc);
- buf.append ("<?xml version=\"1.0\" encoding=\""+encName + "\"?>");
+ buf.append ("<?xml version=\"1.0\" encoding=\"" + encName + "\"?>");
}
public void startElement (String elem)