ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Douglas <mobilechee...@yahoo.com>
Subject Re: org.xml.sax.SAXParseException: Failed to parse integer value:
Date Wed, 23 Aug 2006 12:36:49 GMT
I looked at the example code. However, it seems to have some issues: 
   
      public class MyTypeFactory extends TypeFactoryImpl {
        public MyTypeFactory(XmlRpcController pController) {
            super(pController);
        }

        private DateFormat newFormat() {
            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        }

        public TypeParser getParser(XmlRpcStreamConfig pConfig, NamespaceContextImpl pContext,
String pURI, String pLocalName) {
            if (DateSerializer.DATE_TAG.equals(pLocalName)) {
                return new DateParser(pFormat);
            } else {
                return super.getParser(pConfig, pContext, pURI, pLocalName);
            }
        }

        public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws
SAXException {
            if (pObject instanceof Date) {
                return new DateSerializer(newFormat());
            } else {
                return super.getSerializer(pConfig, pObject);
            }
        }
    }
  ---------------------
   
   
  DateParser and DateSerializer require the argument to be of type 'XmlRpcDateTimeDateFormat'
but in the above code it is of type 'SimpleDateFormat' which causes the 'ClascastException'
to be thrown at runtime. And I noticed that 'XmlRpcDateTimeDateFormat' is an abstract class.
How can we get an instance of it with the formatting "yyyy-MM-dd HH:mm:ss"?

  How can I implement the logic for the XML-RPC to work with 'empty' date/time values? Should
the XML-RPC automatically handle the empty date/time values as it handles the empty int values?

   
  Thanks!


Jochen Wiedmann <jochen.wiedmann@gmail.com> wrote:  Michael Douglas wrote:

> I am a newbie to the Apache XML-RPC world, and hence have no idea about 
> overwriting the typefactory? What I really need to do? Are there any 
> examples available somewhere?

I wrote a section on "custom data types". See

http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/src/site/apt/advanced.apt?view=markup


> Does this 'overwriting typefactory' solution will also work for 'empty' 
> date/time' fields?

Depends on your implementation. :-)


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-user-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-user-help@ws.apache.org



 		
---------------------------------
 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.
Mime
View raw message