Fast Infoset

sub3 <[email protected]> Sat, 11 Sep 2010 20:28:38 -0700 (PDT)
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
Hi,
I am trying to save my XmlBeans objects and I need to use the smallest
amount of disk space possible.  I believe that the Fast Infoset will give me
that.  Please correct me if I am wrong.

Does anyone have any example code to implement this?  I tried using the
example code on the Fast Infoset site, but I am not sure how it interacts
with the XmlBeans.

I've tried to serialize by :
	ByteArrayOutputStream fiDocument = new ByteArrayOutputStream();
	StAXDocumentSerializer staxDocumentSerializer = new
StAXDocumentSerializer();
	staxDocumentSerializer.setOutputStream(fiDocument);

	XMLStreamWriter streamWriter = staxDocumentSerializer;
	// Write out some simple infoset
	streamWriter.writeStartDocument();
	//streamWriter.writeStartElement("foo");
	//streamWriter.writeCharacters("bar");
	streamWriter.writeEndElement();
	streamWriter.writeEndDocument();
	streamWriter.close();
	return fiDocument.toByteArray();

I don't really understand the start/character functions, but even without
that, I am still not getting any data saved.

Assuming the above is a simple fix, would this unserialize the object:
	InputStream fiDocument = new ByteArrayInputStream(bytes);
	XMLStreamReader streamReader = new StAXDocumentParser(fiDocument);
	return AckDocument.Factory.parse(streamReader);

Thanks for any help.

-- 
View this message in context: http://old.nabble.com/Fast-Infoset-tp29688572p29688572.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.