Class DocViewParser
java.lang.Object
org.apache.jackrabbit.vault.fs.io.DocViewParser
This is a thread-safe SAX parser which deals with FileVault Document View XML files
and passes them to a given
DocViewParserHandler.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThrown in case the XML is not well-formed or no valid docview format. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDocViewParser(@NotNull Session session) DocViewParser(@Nullable NamespaceResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable StringgetDocumentViewXmlRootNodePath(InputStream input, Path filePath) Converts the given file path to the absolute root node path given thatInputStreamis complying with the Document View XML format.static booleanisDocView(InputSource source) Checks if the givenInputSourceis complying with the Document View XML format.voidparse(String rootNodePath, InputSource inputSource, DocViewParserHandler handler) Parses a FileVault Document View XML file and calls the given handler for each parsed node.
-
Field Details
-
MAX_NUM_BYTES_TO_READ_FOR_DOCVIEW_DETECTION
public static final int MAX_NUM_BYTES_TO_READ_FOR_DOCVIEW_DETECTION- See Also:
-
-
Constructor Details
-
DocViewParser
public DocViewParser() -
DocViewParser
- Parameters:
session- uses the namespace from the session for resolving otherwise unknown namespace prefixes in docview files
-
DocViewParser
-
-
Method Details
-
isDocView
Checks if the givenInputSourceis complying with the Document View XML format.- Parameters:
source- the source to analyze- Returns:
truein case the given source is Document View XML format- Throws:
IOException- if an I/O error occurs
-
getDocumentViewXmlRootNodePath
@Nullable public static @Nullable String getDocumentViewXmlRootNodePath(InputStream input, Path filePath) throws IOException Converts the given file path to the absolute root node path given thatInputStreamis complying with the Document View XML format.- Parameters:
input- the given input is automatically reset after this method returnsfilePath- the file path of the file containing the potential docview xml, must be relative to the jcr_root directory- Returns:
- either the absolute repository path of the root node of the given docview xml or
nullif no docview xml given - Throws:
IOException
-
parse
public void parse(String rootNodePath, InputSource inputSource, DocViewParserHandler handler) throws IOException, DocViewParser.XmlParseException Parses a FileVault Document View XML file and calls the given handler for each parsed node.- Parameters:
rootNodePath- the path of the root node of the given docview xmlinputSource- the source of the docview xmlhandler- the callback handler which gets the deserialized node information- Throws:
IOExceptionDocViewParser.XmlParseException
-