public class PTreeWriter extends java.lang.Object
The format stored on disk is not dependent on the NamePool. Although it still uses name codes, it also contains a mapping of namecodes to the actual QNames.
The base URIs of nodes are not retained. Line numbers (if they were present in the original tree) are not retained.
|Constructor and Description|
|Modifier and Type||Method and Description|
Static utility method for writing a Ptree
Command line interface for writing a Ptree
Set the PTree version to be written.
Serialize a TinyTree in PTree format to a supplied output stream
public PTreeWriter(ProfessionalConfiguration config)
public void setPTreeVersion(int version)
Saxon 9.9 can read both version 0 and version 1, but always writes version 1, which cannot be read by earlier releases.
version- the version to be written. Must be 1.
public void writeTree(TinyTree tree, java.io.DataOutputStream out) throws java.io.IOException, XPathException
tree- the tree to be serialized
out- the output stream. Responsibility for closing this stream rests with the caller
java.io.IOException- if any error occurs writing to the output stream.
public static void copyToPTree(javax.xml.transform.Source in, ParseOptions options, java.io.OutputStream out) throws XPathException, java.io.IOException
in- the Source representing the document to be written as a PTree
options- the options to be used when processing the input source
out- the OutputStream to which the PTree is written. The responsibility for closing this stream rests with the caller.
XPathException- if any failure occurs processing the input
java.io.IOException- if any failure occurs writing the output
public static void main(java.lang.String args) throws java.lang.Exception
args- [-strip] source.xml out.tree
java.lang.Exception- if the operation fails
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.