Project

Profile

Help

Serializing/Persisting XdmValue

Added by Anonymous over 15 years ago

Legacy ID: #7051163 Legacy Poster: David Lee (daldei)

Have you ever done any experiments (or thought experiments) with serializing or persisting XdmValue , XdmNode, or the ValueRepresentation or NodeInfo ? Consider this use case. Suppose I have a lot of XdmValue objects (probably nodes, documents but suppose any) which are long lived in the JVM. Suppose I'd like to "swap them out" to a file to clean up the memory space for a while, then swap them in later on demand. Maybe some might never be used later. Certianly I could write them out as Text (if they are documents or nodes, or wrap sequences/values in document nodes), and while there is risk of loss of information doing this I suspect if I were careful enough I could get it to work. But what about some sort of binary dump ? Suppose it was the internal TinyTree format and I didn't need the serialized form to be usable in another instance. That way I could avoid saving the NamePool. I would guess that this could be quite a lot more efficient in space and time then serializing and parsing later. I have read from previous posts that serializing compiled XSLT stylesheets is not much of a win vs text and parsing. But what about NodeInfo or Value ? Thanks for any thoughts or ideas. -David


Replies (1)

RE: Serializing/Persisting XdmValue - Added by Anonymous over 15 years ago

Legacy ID: #7051217 Legacy Poster: Michael Kay (mhkay)

The Saxon Ptree (persistent tree) format was designed expressly for this purpose. It's not very widely used, but I think there's a significant benefit over serializing as XML and reparsing, especially if you want to retain type information. Another use case is passing documents between processes running on different machines, for example a more efficient way of encoding the response to a web service request. Further information: http://www.saxonica.com/documentation/sourcedocs/ptree.html Michael Kay

    (1-1/1)

    Please register to reply