commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Paries <rtpar...@gmail.com>
Subject Re: [Digester] getting java.net.MalformedURLException: no protocol:
Date Wed, 23 Mar 2011 17:22:34 GMT
On Wed, Mar 23, 2011 at 12:11 PM, Konstantin Kolinko
<knst.kolinko@gmail.com> wrote:
> 2011/3/23 Randy Paries <rtparies@gmail.com>:
>> Hello,
>> I have a stringBuilder Object that has the xml below::
>> when i try to do
>> Appointments a = (Appointments)digester.parse( sBuf.toString() );
>> i get the exception ::
>> java.net.MalformedURLException: no protocol:
>>
>> Can someone give me a little insight what i may be doing wrong
>
> Digester version = ?
>
> JavaDoc:
> http://commons.apache.org/digester/commons-digester-2.1/docs/api/org/apache/commons/digester/Digester.html#parse%28java.lang.String%29
>
> The URI argument of Digester.parse(String) is the URI, i.e.
> "identifier", address of a document that you are trying to parse.
>
> If you have the document already as a String in memory, use
> Digester.parse(Reader) with a StringReader.
>
>
>>
>> Thanks
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <remind>
>> (...)
>> </remind>
>>
>
> Best regards,
> Konstantin Kolinko
>


Konstantin,
thanks for responding

i am using commons-digester-2.1

So i am now doing:::

            Digester digester = new Digester();
            digester.setValidating( false );

            digester.addObjectCreate( "appointments", Appointments.class );
            digester.addBeanPropertySetter( "appointments/p1", "p1" );
            digester.addBeanPropertySetter( "appointments/p2", "p2" );

            digester.addObjectCreate( "appointments/appointment",
Appointment.class );
            digester.addBeanPropertySetter(
"appointments/appointment/memberID", "memberID" );
            digester.addBeanPropertySetter(
"appointments/appointment/email", "email" );
            digester.addBeanPropertySetter(
"appointments/appointment/cellPhone", "cellPhone" );
            digester.addBeanPropertySetter(
"appointments/appointment/startDate", "startDate" );
            digester.addBeanPropertySetter(
"appointments/appointment/startTime", "startTime" );
            digester.addBeanPropertySetter(
"appointments/appointment/empID", "empID" );
            digester.addBeanPropertySetter(
"appointments/appointment/appointmentType", "appointmentType" );
            digester.addSetNext( "appointments/appointment", "addAppointment" );

            StringReader srreader = new StringReader(sBuf.toString());
            Appointments a = (Appointments)digester.parse( srreader );

but a is always null. No exception. does this mean my mapping is not
set up correctly?

Thanks again

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


Mime
View raw message