xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Feature request: Serializable nodes
- From: Wolfgang Hoschek <whoschek AT lbl.gov>
- To: Steve Loughran <steve.loughran AT gmail.com>
- Cc: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Feature request: Serializable nodes
- Date: Fri, 28 Jan 2005 14:51:17 -0800
On Jan 28, 2005, at 11:54 AM, Steve Loughran wrote:
On Fri, 28 Jan 2005 10:36:35 -0800, Wolfgang Hoschek <whoschek AT lbl.gov> wrote:Steve,
Any particular reason the BinaryXMLCodec wouldn't work here?
Using the codec in combination with RMI is a lot faster than any
standard Java serialization could ever be...
I might have a look; I'd have to think a bit about marshalling stuff
though, maybe writing a wrapper class to marshall the nodes. Yes, a
NodeWrapper class would work -it would do the s12n and so my remote
api could be
NodeWrapper getNode() throws RemoteException;
Yep, something along the following lines:
NodeWrapper.java:
private transient Document doc;
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
bytep[] data = new BinaryXMLCodec().serialize(doc, 0);
out.writeInt(data.length);
out.write(data);
}
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
byte[] data = new byte[in.readInt()];
in.readFully(data, 0, data.length);
doc = new BinaryXMLCodec().deserialize(data);
}
And the wrapper would have the custom marshall/unmarshall stuff. One
question through: does the Codec handle incomplete things like a
comment or an attribute?
What do you mean by incomplete? Currently it handles documents only. If you'd want to transmit just a comment node you'd have to copy the comment node and attach it to an empty document (plus some root element), marshall and then unwrap on the other side. It wouldn't be difficult to make the codec also handle subtrees, i.e. byte[] serialize(ParentNode). I thought about it before but never got round to do it. If you had a patch to that effect it would be most welcome :-)
Wolfgang.
-
[XOM-interest] XPath Mapping on empty text nodes,
shirasu hiroyuki, 01/28/2005
-
[XOM-interest] Feature request: Serializable nodes,
Steve Loughran, 01/28/2005
-
Re: [XOM-interest] Feature request: Serializable nodes,
Elliotte Harold, 01/28/2005
-
Re: [XOM-interest] Feature request: Serializable nodes,
Steve Loughran, 01/28/2005
- Re: [XOM-interest] Feature request: Serializable nodes, Robert Koberg, 01/28/2005
-
Re: [XOM-interest] Feature request: Serializable nodes,
Steve Loughran, 01/28/2005
-
Re: [XOM-interest] Feature request: Serializable nodes,
Wolfgang Hoschek, 01/28/2005
-
Re: [XOM-interest] Feature request: Serializable nodes,
Steve Loughran, 01/28/2005
- Re: [XOM-interest] Feature request: Serializable nodes, Wolfgang Hoschek, 01/28/2005
-
Re: [XOM-interest] Feature request: Serializable nodes,
Steve Loughran, 01/28/2005
-
Re: [XOM-interest] Feature request: Serializable nodes,
Elliotte Harold, 01/28/2005
- Re: [XOM-interest] XPath Mapping on empty text nodes, Elliotte Harold, 01/28/2005
- Re: [XOM-interest] XPath Mapping on empty text nodes, Elliotte Harold, 01/28/2005
-
[XOM-interest] Feature request: Serializable nodes,
Steve Loughran, 01/28/2005
Archive powered by MHonArc 2.6.24.