Level 1 supports the export of repository content to both system view XML and document view XML. The XML can be output either in as a stream or as SAX events.
The export methods are found in the Session object:
javax.jcr. |
|
void |
exportSystemView(String absPath, Serializes the node (and if noRecurse is false, the whole subtree) at absPath into a series of SAX events by calling the methods of the supplied org.xml.sax.ContentHandler. The resulting XML is in the system view form. Note that absPath must be the path of a node, not a property. If skipBinary is true then any properties of PropertyType.BINARY will be serialized as if they are empty. That is, the existence of the property will be serialized, but its content will not appear in the serialized output (the <sv:value> element will have no content). Note that in the case of multi-value BINARY properties, the number of values in the property will be reflected in the serialized output, though they will all be empty. If skipBinary is false then the actual value(s) of each BINARY property is recorded using Base64 encoding. If noRecurse is true then only the node at absPath and its properties, but not its child nodes, are serialized. If noRecurse is false then the entire subtree rooted at absPath is serialized. If the user lacks read access to some subsection of the specified tree that section simply does not get serialized, since, from the user's point of view it is not there. The serialized output will reflect the state of the current workspace as modified by the state of this Session. This means that pending changes (regardless of whether they are valid according to node type constraints) and the current session-mapping of namespaces are reflected in the output. A PathNotFoundException is thrown if no node exists at absPath. A SAXException is thrown if an error occurs while feeding events to the ContentHandler. A RepositoryException is thrown if another error occurs. |
void |
exportSystemView(String absPath, Serializes the node (and if noRecurse is false, the whole subtree) at absPath into an XML stream and outputs it through the supplied OutputStream. The resulting XML is in the system view form. Note that absPath must be the path of a node, not a property. If skipBinary is true then any properties of PropertyType.BINARY will be serialized as if they are empty. That is, the existence of the property will be serialized, but its content will not appear in the serialized output (the <sv:value> element will have no content). Note that in the case of multi-value BINARY properties, the number of values in the property will be reflected in the serialized output, though they will all be empty. If skipBinary is false then the actual value(s) of each BINARY property is recorded using Base64 encoding. If noRecurse is true then only the node at absPath and its properties, but not its child nodes, are serialized. If noRecurse is false then the entire subtree rooted at absPath is serialized. If the user lacks read access to some subsection of the specified tree that section simply does not get serialized, since, from the user's point of view it is not there. The serialized output will reflect the state of the current workspace as modified by the state of this Session. This means that pending changes (regardless of whether they are valid according to node type constraints) and the current session-mapping of namespaces are reflected in the output. The output XML will be encoded in UTF-8. An IOException is thrown if an I/O error occurs. A PathNotFoundException is thrown if no node exists at absPath. A RepositoryException is thrown if another error occurs. |
void |
exportDocumentView(String absPath, Serializes the node (and if noRecurse is false, the whole subtree) at absPath into a series of SAX events by calling the methods of the supplied org.xml.sax.ContentHandler. The resulting XML is in the document view form. Note that absPath must be the path of a node, not a property. If skipBinary is true then any properties of PropertyType.BINARY will be serialized as if they are empty. That is, the existence of the property will be serialized, but its content will not appear in the serialized output (the value of the attribute will be empty). If skipBinary is false then the actual value(s) of each BINARY property is recorded using Base64 encoding. If noRecurse is true then only the node at absPath and its properties, but not its child nodes, are serialized. If noRecurse is false then the entire subtree rooted at absPath is serialized. If the user lacks read access to some subsection of the specified tree that section simply does not get serialized, since, from the user's point of view it is not there. The serialized output will reflect the state of the current workspace as modified by the state of this Session. This means that pending changes (regardless of whether they are valid according to node type constraints) and the current session-mapping of namespaces are reflected in the output. A PathNotFoundException is thrown if no node exists at absPath. A SAXException is thrown if an error occurs while feeding events to the ContentHandler. A RepositoryException is thrown if another error occurs. |
void |
exportDocumentView(String absPath, Serializes the node (and if noRecurse is false, the whole subtree) at absPath into an XML stream and outputs it through the supplied OutputStream. The resulting XML is in the document view form. Note that absPath must be the path of a node, not a property. If skipBinary is true then any properties of PropertyType.BINARY will be serialized as if they are empty. That is, the existence of the property will be serialized, but its content will not appear in the serialized output (the value of the attribute will be empty). If skipBinary is false then the actual value(s) of each BINARY property is recorded using Base64 encoding. If noRecurse is true then only the node at absPath and its properties, but not its child nodes, are serialized. If noRecurse is false then the entire subtree rooted at absPath is serialized. If the user lacks read access to some subsection of the specified tree that section simply does not get serialized, since, from the user's point of view it is not there. The serialized output will reflect the state of the current workspace as modified by the state of this Session. This means that pending changes (regardless of whether they are valid according to node type constraints) and the current session-mapping of namespaces are reflected in the output. The output XML will be encoded in UTF-8. An IOException is thrown if an I/O error occurs. A PathNotFoundException is thrown if no node exists at absPath. A RepositoryException is thrown if another error occurs. |