IOException serializing objects to XML
IOException serializing objects to XML
- Subject: IOException serializing objects to XML
- From: Omar <email@hidden>
- Date: Thu, 16 Feb 2006 14:06:32 -0500
Hi all,
I am having serializing an object that contains HTML code that's
approximately 51K to XML, I am using the following code:
NSXMLOutputStream loXMLStream = null;
String lsData = null;
ByteArrayOutputStream loByteStream = new ByteArrayOutputStream();
try {
loXMLStream = new NSXMLOutputStream(loByteStream);
NSXMLOutputFormat format = new NSXMLOutputFormat(true);
format.setOmitXMLDeclaration(true);
format.setIndenting(false);
loXMLStream.setOutputFormat(format);
NSMutableDictionary loObject = new NSMutableDictionary();
vEOToNSDictionary(loObject, loEncodeObject,
laRelationshipKeyPaths);
loXMLStream.writeObject(loObject);
loXMLStream.close();
lsData = loByteStream.toString("UTF-8");
loByteStream.close();
} catch (Exception loException) {
loException.printStackTrace();
}
return(lsData);
When I use this code on a smaller file, it works ok, but with the 51K
file, it gives me this exception:
java.io.IOException
at
com.webobjects.foundation.xml.NSXMLOutputStream.invoke(NSXMLOutputStream.java:630)
at
com.webobjects.foundation.xml.NSXMLOutputStream.callWriteObjectOverridden(NSXMLOutputStream.java:1137)
at
com.webobjects.foundation.xml.NSXMLOutputStream._writeSerializable(NSXMLOutputStream.java:864)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeSerializable(NSXMLOutputStream.java:892)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeNormalObject(NSXMLOutputStream.java:992)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeInternalObject(NSXMLOutputStream.java:724)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeArrayData(NSXMLOutputStream.java:1072)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeArray(NSXMLOutputStream.java:1095)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeInternalObject(NSXMLOutputStream.java:721)
at
com.webobjects.foundation.xml._NSXMLPutField.writeFields(_NSXMLPutField.java:161)
at
com.webobjects.foundation.xml._NSXMLPutField.writeFields(_NSXMLPutField.java:193)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeFields(NSXMLOutputStream.java:1436)
at com.webobjects.foundation.NSArray.writeObject(NSArray.java:1558)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.webobjects.foundation.xml.NSXMLOutputStream.invoke(NSXMLOutputStream.java:621)
at
com.webobjects.foundation.xml.NSXMLOutputStream.callWriteObjectOverridden(NSXMLOutputStream.java:1137)
at
com.webobjects.foundation.xml.NSXMLOutputStream._writeSerializable(NSXMLOutputStream.java:864)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeSerializable(NSXMLOutputStream.java:892)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeNormalObject(NSXMLOutputStream.java:992)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeInternalObject(NSXMLOutputStream.java:724)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeArrayData(NSXMLOutputStream.java:1072)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeArray(NSXMLOutputStream.java:1095)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeInternalObject(NSXMLOutputStream.java:721)
at
com.webobjects.foundation.xml._NSXMLPutField.writeFields(_NSXMLPutField.java:161)
at
com.webobjects.foundation.xml._NSXMLPutField.writeFields(_NSXMLPutField.java:193)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeFields(NSXMLOutputStream.java:1436)
at
com.webobjects.foundation.NSDictionary.writeObject(NSDictionary.java:879)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.webobjects.foundation.xml.NSXMLOutputStream.invoke(NSXMLOutputStream.java:621)
at
com.webobjects.foundation.xml.NSXMLOutputStream.callWriteObjectOverridden(NSXMLOutputStream.java:1137)
at
com.webobjects.foundation.xml.NSXMLOutputStream._writeSerializable(NSXMLOutputStream.java:864)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeSerializable(NSXMLOutputStream.java:892)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeNormalObject(NSXMLOutputStream.java:992)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeInternalObject(NSXMLOutputStream.java:724)
at
com.webobjects.foundation.xml.NSXMLOutputStream.writeObjectOverride(NSXMLOutputStream.java:1210)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:274)
Is there any way to overcome this limitation or am I doing something wrong?
Thanks in advance,
Omar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden