Class PMRDocumentBuilder
java.lang.Object
javax.xml.parsers.DocumentBuilder
org.episteme.natural.chemistry.loaders.cml.dom.pmr.PMRDocumentBuilder
A wrapper for
DocumentBuilder that returns PMRDocumentImpl instances.- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DocumentBuilderThe underlying generic document builder. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedno-argPMRDocumentBuilder(String className) Default unimplemented constructor.PMRDocumentBuilder(DocumentBuilder documentBuilder) Creates a new PMRDocumentBuilder that wraps a default DocumentBuilder. -
Method Summary
Modifier and TypeMethodDescriptionObtain an instance of a PMRDOMImplementation object.booleanIndicates whether or not this parser is configured to understand namespaces.booleanIndicates whether or not this parser is configured to validate XML documents.Obtain a new instance of a DOMPMRDocumentobject to build a DOM tree with.Parse the content of the given file as an XML document and return a new DOM Document object.parse(InputStream is) Parse the content of the given InputStream as an XML document and return a new DOM Document object.parse(InputStream is, String systemId) Parse the content of the given InputStream as an XML document and return a new DOM Document object.Parse the content of the given URI as an XML document and return a new DOM Document object.parse(InputSource is) Parse the content of the given input source as an XML document and return a new DOM Document object.voidSpecify the EntityResolver to be used to resolve entities present in the XML document to be parsed.voidSpecify the ErrorHandler to be used to report errors present in the XML document to be parsed.Methods inherited from class DocumentBuilder
getSchema, isXIncludeAware, reset
-
Field Details
-
documentBuilder
The underlying generic document builder.
-
-
Constructor Details
-
PMRDocumentBuilder
protected PMRDocumentBuilder()no-arg -
PMRDocumentBuilder
Creates a new PMRDocumentBuilder that wraps a default DocumentBuilder.- Parameters:
documentBuilder- the base document builder to wrap
-
PMRDocumentBuilder
Default unimplemented constructor.- Parameters:
className- the name of the builder class (currently unused)
-
-
Method Details
-
setEntityResolver
Specify the EntityResolver to be used to resolve entities present in the XML document to be parsed.- Specified by:
setEntityResolverin classDocumentBuilder- Parameters:
er- the EntityResolver to be used
-
setErrorHandler
Specify the ErrorHandler to be used to report errors present in the XML document to be parsed.- Specified by:
setErrorHandlerin classDocumentBuilder- Parameters:
eh- the ErrorHandler to be used
-
parse
Parse the content of the given InputStream as an XML document and return a new DOM Document object.- Overrides:
parsein classDocumentBuilder- Parameters:
is- InputStream containing the content to be parsed.- Returns:
- a new PMRDocument object.
- Throws:
SAXException- if any parse errors occur.IOException- if any IO errors occur.
-
parse
Parse the content of the given InputStream as an XML document and return a new DOM Document object.- Overrides:
parsein classDocumentBuilder- Parameters:
is- InputStream containing the content to be parsed.systemId- base URI for resolving relative URIs.- Returns:
- a new PMRDocument object.
- Throws:
SAXException- if any parse errors occur.IOException- if any IO errors occur.
-
parse
Parse the content of the given URI as an XML document and return a new DOM Document object.- Overrides:
parsein classDocumentBuilder- Parameters:
uri- the location of the content to be parsed.- Returns:
- a new PMRDocument object.
- Throws:
SAXException- if any parse errors occur.IOException- if any IO errors occur.
-
parse
Parse the content of the given file as an XML document and return a new DOM Document object.- Overrides:
parsein classDocumentBuilder- Parameters:
f- the file containing the XML to parse.- Returns:
- a new PMRDocument object.
- Throws:
SAXException- if any parse errors occur.IOException- if any IO errors occur.
-
parse
Parse the content of the given input source as an XML document and return a new DOM Document object.- Specified by:
parsein classDocumentBuilder- Parameters:
is- InputSource containing the content to be parsed.- Returns:
- a new PMRDocument object.
- Throws:
SAXException- if any parse errors occur.IOException- if any IO errors occur.
-
isNamespaceAware
public boolean isNamespaceAware()Indicates whether or not this parser is configured to understand namespaces.- Specified by:
isNamespaceAwarein classDocumentBuilder- Returns:
- true if namespace aware, false otherwise
-
isValidating
public boolean isValidating()Indicates whether or not this parser is configured to validate XML documents.- Specified by:
isValidatingin classDocumentBuilder- Returns:
- true if validating, false otherwise
-
newDocument
Obtain a new instance of a DOMPMRDocumentobject to build a DOM tree with.- Specified by:
newDocumentin classDocumentBuilder- Returns:
- a new PMRDocument instance
-
getDOMImplementation
Obtain an instance of a PMRDOMImplementation object.- Specified by:
getDOMImplementationin classDocumentBuilder- Returns:
- A new instance of a PMRDOMImplementation.
-