Interface XMLDocument
-
- All Superinterfaces:
Document
,XMLContextResolver
- All Known Subinterfaces:
MutableXMLDocument
- All Known Implementing Classes:
AbstractJDOMDocument
,CompositeXMLDocument
,JDOMDocument
,XMLDocumentFragment
public interface XMLDocument extends Document, XMLContextResolver
Represents an instance of XML that can be reused for various forms of XML processing. Implementations of this class can choose to locally cache the XML and apply any pre-processing steps required to prepare the XML for use.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
asString(org.jdom2.output.Format format)
Retrieves the document as a string.void
copyTo(File outputFile)
Writes a copy of the document to the provided file.org.jdom2.Document
getJDOMDocument()
Provides access to a (defensive) copy of the underlying JDOM document.Source
getSource()
Retrieves the document as an XML transformation source.XMLDocumentFragment
newXMLDocumentFragment(String xpath)
XMLDocumentFragment
newXMLDocumentFragment(org.jdom2.Element element)
Creates anXMLDocumentFragment
based on a sub-tree of the current document instance.XPathEvaluator
newXPathEvaluator()
Returns an XPath 2.0 evaluator.-
Methods inherited from interface gov.nist.secauto.decima.core.document.Document
getOriginalLocation, getSourceInfo, getSystemId, newInputStream
-
Methods inherited from interface gov.nist.secauto.decima.xml.document.context.XMLContextResolver
getContext, getContext, getSystemId, getXPath, getXPath
-
-
-
-
Method Detail
-
getSource
Source getSource()
Retrieves the document as an XML transformation source. This instance of the document is expected to be in a ready-to-be-processed state. Modifications to the returned instance should not affect the actual template. It may be necessary to make a defensive copy to ensure this.- Returns:
- an input source based on a copy of the template
-
newXPathEvaluator
XPathEvaluator newXPathEvaluator() throws XPathFactoryConfigurationException
Returns an XPath 2.0 evaluator.- Returns:
- the evaluator
- Throws:
XPathFactoryConfigurationException
- if an error occurred while instantiating a new XPathFactory instance
-
newXMLDocumentFragment
XMLDocumentFragment newXMLDocumentFragment(String xpath) throws DocumentException
- Throws:
DocumentException
-
newXMLDocumentFragment
XMLDocumentFragment newXMLDocumentFragment(org.jdom2.Element element) throws DocumentException
Creates anXMLDocumentFragment
based on a sub-tree of the current document instance.- Parameters:
element
- the element in the current document instance to use as the base of the sub-tree- Returns:
- a new
XMLDocumentFragment
for the sub-tree - Throws:
DocumentException
- if an error occurred while parsing the document
-
getJDOMDocument
org.jdom2.Document getJDOMDocument()
Provides access to a (defensive) copy of the underlying JDOM document.- Returns:
- a copy of the underlying JDOM document
-
copyTo
void copyTo(File outputFile) throws FileNotFoundException, IOException
Writes a copy of the document to the provided file.- Parameters:
outputFile
- the file to write to- Throws:
FileNotFoundException
- if the path to the file does not existIOException
- if an error occurs while writing to the file
-
asString
String asString(org.jdom2.output.Format format) throws IOException
Retrieves the document as a string.- Parameters:
format
- the format to use during the conversion- Returns:
- a string representation of the document
- Throws:
IOException
- if an error occurs while outputting the document as a dtring
-
-