Package org.openpreservation.odf.xml
Class OdfXmlDocuments
java.lang.Object
org.openpreservation.odf.xml.OdfXmlDocuments
-
Method Summary
Modifier and TypeMethodDescriptionstatic final boolean
Determines whether the supplied path is an XML document or not.static final Metadata
metadataFrom
(InputStream metaStream) Instantiates a Metadata object from an InputStream.static final Metadata
metadataOf
(String version, Map<String, String> stringValues, List<Metadata.UserDefinedField> userDefinedFields) Instantiates a Metadata object from a version string, a Map of string values, and a List of UserDefinedFields.static final OdfXmlDocument
odfXmlDocumentOf
(ParseResult parseResult) Instantiates an OdfXmlDocument from an XML ParseResultstatic final OdfXmlDocument
xmlDocumentFrom
(InputStream docStream) Instatiates an OdfXmlDocument from an InputStream.
-
Method Details
-
odfXmlDocumentOf
Instantiates an OdfXmlDocument from an XML ParseResult- Parameters:
parseResult
- a org.openpreservation.format.xml.ParseResult from parsing an ODF XML document.- Returns:
- an OdfXmlDocument instance created from the passed ParseResult
-
xmlDocumentFrom
public static final OdfXmlDocument xmlDocumentFrom(InputStream docStream) throws IOException, ParserConfigurationException, SAXException Instatiates an OdfXmlDocument from an InputStream.- Parameters:
docStream
- an InputStream to an ODF XML document.- Returns:
- an OdfXmlDocument instance created from the passed InputStream.
- Throws:
IOException
- When there is an error reading the InputStream.ParserConfigurationException
- When the XML parser cannot be configured, probably a system setup issue.SAXException
- When an exception occurs during SAX processing, likely a system setup issue.
-
metadataOf
public static final Metadata metadataOf(String version, Map<String, String> stringValues, List<Metadata.UserDefinedField> userDefinedFields) Instantiates a Metadata object from a version string, a Map of string values, and a List of UserDefinedFields.- Parameters:
version
- the version of the ODF XML Metadata block/document.stringValues
- a Map of the key value pairs that comprise the standard Metadata values.userDefinedFields
- a List of the UserDefinedFields that comprise the Metadata block/document.- Returns:
- a Metadata object created from the passed parameters.
-
metadataFrom
public static final Metadata metadataFrom(InputStream metaStream) throws ParserConfigurationException, SAXException, IOException Instantiates a Metadata object from an InputStream.- Parameters:
metaStream
- and InputStream to an ODF XML document thought to contain a metadata element.- Returns:
- a Metadata object created from the passed InputStream.
- Throws:
IOException
- When there is an error reading the InputStream.ParserConfigurationException
- When the XML parser cannot be configured, probably a system setup issue.SAXException
- When an exception occurs during SAX processing, likely a system setup issue.
-
isXml
Determines whether the supplied path is an XML document or not.- Parameters:
toCheck
- a Java Path for the file to check- Returns:
- true if the supplied path is an XML document, false otherwise.
- Throws:
IOException
- when there is an error reading the file.
-