You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Lastdot <ki...@gmail.com> on 2006/12/12 13:00:00 UTC

Problems with Serialization

Hi,
When i try to serialize a DOM document to an output stream i always get the
same error: when i create a DOMImplementatiosLS object it gets a null value
so, when i try to use this object to get a LSSerializer object i get a null
pointer exception.
I've tried everything, and i don´t know what to do....
Here is a snippet of the code, in fact, it´s copied from Xerces official
page:



import  org.w3c.dom.bootstrap.DOMImplementationRegistry;
import  org.w3c.dom.Document;
import  org.w3c.dom.ls.DOMImplementationLS;
import  org.w3c.dom.ls.LSSerializer;

	DOMImplementationRegistry registry =
DOMImplementationRegistry.newInstance(); 
(1)	DOMImplementation domImpl = registry.getDOMImplementation("LS");
(2)	DOMImplementationLS implLS = (DOMImplementationLS)domImpl;
	LSSerializer writer = implLS.createLSSerializer();


(1) At this point i get an object with a null value
(2) Here a null pointer exception


Any help would be appreciated, i´m stuck and desperate....
-- 
View this message in context: http://www.nabble.com/Problems-with-Serialization-tf2807098.html#a7831858
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Problems with Serialization

Posted by tibot <ti...@yahoo.fr>.
Great. It works. THan k you very much


Michael Glavassevich wrote:
> 
> If you're using JDK 1.4 or above you need to use the "Endorsed Standards 
> Override Mechanism" [1][2].
> 
> [1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-4
> [2] http://java.sun.com/j2se/1.4.2/docs/guide/standards/
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> Lastdot <ki...@gmail.com> wrote on 01/25/2007 01:58:57 PM:
> 
>> You have to compille  the program using Xerce's librarys, giving to the
>> compiler the right path: javac -classpath (Xerce's path library)
>> 
>> tibot wrote:
>> > 
>> > Hello,
>> > 
>> > It seems I have the same problem but I don't see what you have done to
>> > make it work.
>> > 
>> > Thank you 
>> > 
>> > 
>> > 
>> > Lastdot wrote:
>> >> 
>> >> Yes.....!!! That was the reason, the thing is that i´ve already tried 
> to
>> >> compille the program giving to the compiler the Xerce's classpath,but 
> i
>> >> wasn't giving the right jar's name. This time to make sure i gave to 
> it
>> >> as parameter every packages and it worked!!!!
>> >>  Thank you very much indeed!!!!
>> >> 
>> >> Michael Glavassevich wrote:
>> >>> 
>> >>> Lastdot <ki...@gmail.com> wrote on 12/12/2006 07:00:00 AM:
>> >>> 
>> >>>> Hi,
>> >>>> When i try to serialize a DOM document to an output stream i always 
> get 
>> >>> the
>> >>>> same error: when i create a DOMImplementatiosLS object it gets a 
> null 
>> >>> value
>> >>>> so, when i try to use this object to get a LSSerializer object i 
> get a 
>> >>> null
>> >>>> pointer exception.
>> >>>> I've tried everything, and i don´t know what to do....
>> >>>> Here is a snippet of the code, in fact, it´s copied from Xerces
>> >>>> official
>> >>>> page:
>> >>>> 
>> >>>> 
>> >>>> 
>> >>>> import  org.w3c.dom.bootstrap.DOMImplementationRegistry;
>> >>>> import  org.w3c.dom.Document;
>> >>>> import  org.w3c.dom.ls.DOMImplementationLS;
>> >>>> import  org.w3c.dom.ls.LSSerializer;
>> >>>> 
>> >>>>    DOMImplementationRegistry registry =
>> >>>> DOMImplementationRegistry.newInstance(); 
>> >>>> (1)   DOMImplementation domImpl = 
> registry.getDOMImplementation("LS");
>> >>>> (2)   DOMImplementationLS implLS = (DOMImplementationLS)domImpl;
>> >>>>    LSSerializer writer = implLS.createLSSerializer();
>> >>>> 
>> >>>> 
>> >>>> (1) At this point i get an object with a null value
>> >>>> (2) Here a null pointer exception
>> >>>>
>> >>>> Any help would be appreciated, i´m stuck and desperate....
>> >>> 
>> >>> Probably a bug in Java 5. This works with the Apache version. Are 
> you
>> >>> sure 
>> >>> you were actually using Xerces when you tried this?
>> >>> 
>> >>>> -- 
>> >>>> View this message in context: http://www.nabble.com/Problems-with-
>> >>>> Serialization-tf2807098.html#a7831858
>> >>>> Sent from the Xerces - J - Users mailing list archive at 
> Nabble.com.
>> >>>> 
>> >>>> 
>> >>>> 
> ---------------------------------------------------------------------
>> >>>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> >>>> For additional commands, e-mail: j-users-help@xerces.apache.org
>> >>> 
>> >>> Michael Glavassevich
>> >>> XML Parser Development
>> >>> IBM Toronto Lab
>> >>> E-mail: mrglavas@ca.ibm.com
>> >>> E-mail: mrglavas@apache.org
>> >>> 
>> >>> 
> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> >>> For additional commands, e-mail: j-users-help@xerces.apache.org
>> >>> 
>> >>> 
>> >>> 
>> >> 
>> >> 
>> > 
>> > 
>> 
>> -- 
>> View this message in context: http://www.nabble.com/Problems-with-
>> Serialization-tf2807098.html#a8639147
>> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-with-Serialization-tf2807098.html#a8647885
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Problems with Serialization

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
If you're using JDK 1.4 or above you need to use the "Endorsed Standards 
Override Mechanism" [1][2].

[1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-4
[2] http://java.sun.com/j2se/1.4.2/docs/guide/standards/

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Lastdot <ki...@gmail.com> wrote on 01/25/2007 01:58:57 PM:

> You have to compille  the program using Xerce's librarys, giving to the
> compiler the right path: javac -classpath (Xerce's path library)
> 
> tibot wrote:
> > 
> > Hello,
> > 
> > It seems I have the same problem but I don't see what you have done to
> > make it work.
> > 
> > Thank you 
> > 
> > 
> > 
> > Lastdot wrote:
> >> 
> >> Yes.....!!! That was the reason, the thing is that i´ve already tried 
to
> >> compille the program giving to the compiler the Xerce's classpath,but 
i
> >> wasn't giving the right jar's name. This time to make sure i gave to 
it
> >> as parameter every packages and it worked!!!!
> >>  Thank you very much indeed!!!!
> >> 
> >> Michael Glavassevich wrote:
> >>> 
> >>> Lastdot <ki...@gmail.com> wrote on 12/12/2006 07:00:00 AM:
> >>> 
> >>>> Hi,
> >>>> When i try to serialize a DOM document to an output stream i always 
get 
> >>> the
> >>>> same error: when i create a DOMImplementatiosLS object it gets a 
null 
> >>> value
> >>>> so, when i try to use this object to get a LSSerializer object i 
get a 
> >>> null
> >>>> pointer exception.
> >>>> I've tried everything, and i don´t know what to do....
> >>>> Here is a snippet of the code, in fact, it´s copied from Xerces
> >>>> official
> >>>> page:
> >>>> 
> >>>> 
> >>>> 
> >>>> import  org.w3c.dom.bootstrap.DOMImplementationRegistry;
> >>>> import  org.w3c.dom.Document;
> >>>> import  org.w3c.dom.ls.DOMImplementationLS;
> >>>> import  org.w3c.dom.ls.LSSerializer;
> >>>> 
> >>>>    DOMImplementationRegistry registry =
> >>>> DOMImplementationRegistry.newInstance(); 
> >>>> (1)   DOMImplementation domImpl = 
registry.getDOMImplementation("LS");
> >>>> (2)   DOMImplementationLS implLS = (DOMImplementationLS)domImpl;
> >>>>    LSSerializer writer = implLS.createLSSerializer();
> >>>> 
> >>>> 
> >>>> (1) At this point i get an object with a null value
> >>>> (2) Here a null pointer exception
> >>>>
> >>>> Any help would be appreciated, i´m stuck and desperate....
> >>> 
> >>> Probably a bug in Java 5. This works with the Apache version. Are 
you
> >>> sure 
> >>> you were actually using Xerces when you tried this?
> >>> 
> >>>> -- 
> >>>> View this message in context: http://www.nabble.com/Problems-with-
> >>>> Serialization-tf2807098.html#a7831858
> >>>> Sent from the Xerces - J - Users mailing list archive at 
Nabble.com.
> >>>> 
> >>>> 
> >>>> 
---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> >>>> For additional commands, e-mail: j-users-help@xerces.apache.org
> >>> 
> >>> Michael Glavassevich
> >>> XML Parser Development
> >>> IBM Toronto Lab
> >>> E-mail: mrglavas@ca.ibm.com
> >>> E-mail: mrglavas@apache.org
> >>> 
> >>> 
---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> >>> For additional commands, e-mail: j-users-help@xerces.apache.org
> >>> 
> >>> 
> >>> 
> >> 
> >> 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Problems-with-
> Serialization-tf2807098.html#a8639147
> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Problems with Serialization

Posted by Lastdot <ki...@gmail.com>.
You have to compille  the program using Xerce's librarys, giving to the
compiler the right path: javac -classpath (Xerce's path library)

tibot wrote:
> 
> Hello,
> 
> It seems I have the same problem but I don't see what you have done to
> make it work.
> 
> Thank you 
> 
> 
> 
> Lastdot wrote:
>> 
>> Yes.....!!! That was the reason, the thing is that i´ve already tried to
>> compille the program giving to the compiler the Xerce's classpath,but i
>> wasn't giving the right jar's name. This time to make sure i gave to it
>> as parameter every packages and it worked!!!!
>>  Thank you very much indeed!!!!
>> 
>> Michael Glavassevich wrote:
>>> 
>>> Lastdot <ki...@gmail.com> wrote on 12/12/2006 07:00:00 AM:
>>>  
>>>> Hi,
>>>> When i try to serialize a DOM document to an output stream i always get 
>>> the
>>>> same error: when i create a DOMImplementatiosLS object it gets a null 
>>> value
>>>> so, when i try to use this object to get a LSSerializer object i get a 
>>> null
>>>> pointer exception.
>>>> I've tried everything, and i don´t know what to do....
>>>> Here is a snippet of the code, in fact, it´s copied from Xerces
>>>> official
>>>> page:
>>>> 
>>>> 
>>>> 
>>>> import  org.w3c.dom.bootstrap.DOMImplementationRegistry;
>>>> import  org.w3c.dom.Document;
>>>> import  org.w3c.dom.ls.DOMImplementationLS;
>>>> import  org.w3c.dom.ls.LSSerializer;
>>>> 
>>>>    DOMImplementationRegistry registry =
>>>> DOMImplementationRegistry.newInstance(); 
>>>> (1)   DOMImplementation domImpl = registry.getDOMImplementation("LS");
>>>> (2)   DOMImplementationLS implLS = (DOMImplementationLS)domImpl;
>>>>    LSSerializer writer = implLS.createLSSerializer();
>>>> 
>>>> 
>>>> (1) At this point i get an object with a null value
>>>> (2) Here a null pointer exception
>>>>
>>>> Any help would be appreciated, i´m stuck and desperate....
>>> 
>>> Probably a bug in Java 5. This works with the Apache version. Are you
>>> sure 
>>> you were actually using Xerces when you tried this?
>>> 
>>>> -- 
>>>> View this message in context: http://www.nabble.com/Problems-with-
>>>> Serialization-tf2807098.html#a7831858
>>>> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>>>> For additional commands, e-mail: j-users-help@xerces.apache.org
>>> 
>>> Michael Glavassevich
>>> XML Parser Development
>>> IBM Toronto Lab
>>> E-mail: mrglavas@ca.ibm.com
>>> E-mail: mrglavas@apache.org
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>>> For additional commands, e-mail: j-users-help@xerces.apache.org
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-with-Serialization-tf2807098.html#a8639147
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Problems with Serialization

Posted by tibot <ti...@yahoo.fr>.
Hello,

It seems I have the same problem but I don't see what you have done to make
it work.

Thank you 



Lastdot wrote:
> 
> Yes.....!!! That was the reason, the thing is that i´ve already tried to
> compille the program giving to the compiler the Xerce's classpath,but i
> wasn't giving the right jar's name. This time to make sure i gave to it as
> parameter every packages and it worked!!!!
>  Thank you very much indeed!!!!
> 
> Michael Glavassevich wrote:
>> 
>> Lastdot <ki...@gmail.com> wrote on 12/12/2006 07:00:00 AM:
>>  
>>> Hi,
>>> When i try to serialize a DOM document to an output stream i always get 
>> the
>>> same error: when i create a DOMImplementatiosLS object it gets a null 
>> value
>>> so, when i try to use this object to get a LSSerializer object i get a 
>> null
>>> pointer exception.
>>> I've tried everything, and i don´t know what to do....
>>> Here is a snippet of the code, in fact, it´s copied from Xerces official
>>> page:
>>> 
>>> 
>>> 
>>> import  org.w3c.dom.bootstrap.DOMImplementationRegistry;
>>> import  org.w3c.dom.Document;
>>> import  org.w3c.dom.ls.DOMImplementationLS;
>>> import  org.w3c.dom.ls.LSSerializer;
>>> 
>>>    DOMImplementationRegistry registry =
>>> DOMImplementationRegistry.newInstance(); 
>>> (1)   DOMImplementation domImpl = registry.getDOMImplementation("LS");
>>> (2)   DOMImplementationLS implLS = (DOMImplementationLS)domImpl;
>>>    LSSerializer writer = implLS.createLSSerializer();
>>> 
>>> 
>>> (1) At this point i get an object with a null value
>>> (2) Here a null pointer exception
>>>
>>> Any help would be appreciated, i´m stuck and desperate....
>> 
>> Probably a bug in Java 5. This works with the Apache version. Are you
>> sure 
>> you were actually using Xerces when you tried this?
>> 
>>> -- 
>>> View this message in context: http://www.nabble.com/Problems-with-
>>> Serialization-tf2807098.html#a7831858
>>> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>>> For additional commands, e-mail: j-users-help@xerces.apache.org
>> 
>> Michael Glavassevich
>> XML Parser Development
>> IBM Toronto Lab
>> E-mail: mrglavas@ca.ibm.com
>> E-mail: mrglavas@apache.org
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-with-Serialization-tf2807098.html#a8632728
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Problems with Serialization

Posted by Lastdot <ki...@gmail.com>.
Yes.....!!! That was the reason, the thing is that i´ve already tried to
compille the program giving to the compiler the Xerce's classpath,but i
wasn't giving the right jar's name. This time to make sure i gave to it as
parameter every packages and it worked!!!!
 Thank you very much indeed!!!!

Michael Glavassevich wrote:
> 
> Lastdot <ki...@gmail.com> wrote on 12/12/2006 07:00:00 AM:
>  
>> Hi,
>> When i try to serialize a DOM document to an output stream i always get 
> the
>> same error: when i create a DOMImplementatiosLS object it gets a null 
> value
>> so, when i try to use this object to get a LSSerializer object i get a 
> null
>> pointer exception.
>> I've tried everything, and i don´t know what to do....
>> Here is a snippet of the code, in fact, it´s copied from Xerces official
>> page:
>> 
>> 
>> 
>> import  org.w3c.dom.bootstrap.DOMImplementationRegistry;
>> import  org.w3c.dom.Document;
>> import  org.w3c.dom.ls.DOMImplementationLS;
>> import  org.w3c.dom.ls.LSSerializer;
>> 
>>    DOMImplementationRegistry registry =
>> DOMImplementationRegistry.newInstance(); 
>> (1)   DOMImplementation domImpl = registry.getDOMImplementation("LS");
>> (2)   DOMImplementationLS implLS = (DOMImplementationLS)domImpl;
>>    LSSerializer writer = implLS.createLSSerializer();
>> 
>> 
>> (1) At this point i get an object with a null value
>> (2) Here a null pointer exception
>>
>> Any help would be appreciated, i´m stuck and desperate....
> 
> Probably a bug in Java 5. This works with the Apache version. Are you sure 
> you were actually using Xerces when you tried this?
> 
>> -- 
>> View this message in context: http://www.nabble.com/Problems-with-
>> Serialization-tf2807098.html#a7831858
>> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problems-with-Serialization-tf2807098.html#a7850366
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Problems with Serialization

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Lastdot <ki...@gmail.com> wrote on 12/12/2006 07:00:00 AM:
 
> Hi,
> When i try to serialize a DOM document to an output stream i always get 
the
> same error: when i create a DOMImplementatiosLS object it gets a null 
value
> so, when i try to use this object to get a LSSerializer object i get a 
null
> pointer exception.
> I've tried everything, and i don´t know what to do....
> Here is a snippet of the code, in fact, it´s copied from Xerces official
> page:
> 
> 
> 
> import  org.w3c.dom.bootstrap.DOMImplementationRegistry;
> import  org.w3c.dom.Document;
> import  org.w3c.dom.ls.DOMImplementationLS;
> import  org.w3c.dom.ls.LSSerializer;
> 
>    DOMImplementationRegistry registry =
> DOMImplementationRegistry.newInstance(); 
> (1)   DOMImplementation domImpl = registry.getDOMImplementation("LS");
> (2)   DOMImplementationLS implLS = (DOMImplementationLS)domImpl;
>    LSSerializer writer = implLS.createLSSerializer();
> 
> 
> (1) At this point i get an object with a null value
> (2) Here a null pointer exception
>
> Any help would be appreciated, i´m stuck and desperate....

Probably a bug in Java 5. This works with the Apache version. Are you sure 
you were actually using Xerces when you tried this?

> -- 
> View this message in context: http://www.nabble.com/Problems-with-
> Serialization-tf2807098.html#a7831858
> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org