pub trait DOMImplementation {
type NodeRef;
// Required methods
fn create_document(
&self,
namespace_uri: Option<&str>,
qualified_name: Option<&str>,
doc_type: Option<Self::NodeRef>,
) -> Result<Self::NodeRef>;
fn create_document_type(
&self,
qualified_name: &str,
public_id: Option<&str>,
system_id: Option<&str>,
) -> Result<Self::NodeRef>;
fn has_feature(&self, feature: &str, version: &str) -> bool;
}Expand description
This corresponds to the DOM DOMImplementation interface.
The instance used to create a document can be retrieved using the implementation method on
Document. To fetch an implementation to create a document iun the
first place use the function get_implementation.
§Specification
The DOMImplementation interface provides a number of methods for performing operations that
are independent of any particular instance of the document object model.
Required Associated Types§
Required Methods§
Sourcefn create_document(
&self,
namespace_uri: Option<&str>,
qualified_name: Option<&str>,
doc_type: Option<Self::NodeRef>,
) -> Result<Self::NodeRef>
fn create_document( &self, namespace_uri: Option<&str>, qualified_name: Option<&str>, doc_type: Option<Self::NodeRef>, ) -> Result<Self::NodeRef>
Creates an XML Document object of the specified type with its document element.
Note: This method will panic if it cannot create the document node.
Note: This will create a new document that includes namespace support and strict ID
processing. If you wish to change these options, see
create_document_with_options
§Specification
HTML-only DOM implementations do not need to implement this method. Introduced in DOM Level 2
Parameters
namespaceURIof typeDOMString: The namespace URI of the document element to create.qualifiedNameof typeDOMString: The qualified name of the document element to be created.doctypeof typeDocumentType: The type of document to be created or null. When doctype is not null, its Node.ownerDocument attribute is set to the document being created.
Return Value
Document: A new Document object.
Exceptions
INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.NAMESPACE_ERR: Raised if the qualifiedName is malformed, if the qualifiedName has a prefix and the namespaceURI is null, or if the qualifiedName has a prefix that is “xml” and the namespaceURI is different from <http://www.w3.org/XML/1998/namespace>.WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document or was created from a different implementation.
Sourcefn create_document_type(
&self,
qualified_name: &str,
public_id: Option<&str>,
system_id: Option<&str>,
) -> Result<Self::NodeRef>
fn create_document_type( &self, qualified_name: &str, public_id: Option<&str>, system_id: Option<&str>, ) -> Result<Self::NodeRef>
Creates an empty DocumentType node.
§Specification
Entity declarations and notations are not made available. Entity reference expansions and
default attribute additions do not occur. It is expected that a future version of the DOM
will provide a way for populating a DocumentType. Introduced in DOM Level 2
HTML-only DOM implementations do not need to implement this method.
Parameters
qualifiedNameof typeDOMString: The qualified name of the document type to be created.publicIdof typeDOMString: The external subset public identifier.systemIdof typeDOMString: The external subset system identifier.
Return Value
DocumentType: A new DocumentType node with Node.ownerDocument set to null.
Exceptions
INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.NAMESPACE_ERR: Raised if thequalifiedNameis malformed.
Sourcefn has_feature(&self, feature: &str, version: &str) -> bool
fn has_feature(&self, feature: &str, version: &str) -> bool
Test if the DOM implementation implements a specific feature.
§Specification
See DOM Level 2 Core §1.3. Extended Interfaces
Parameters
featureof typeDOMString: The name of the feature to test (case-insensitive). The values used by DOM features are defined throughout the DOM Level 2 specifications and listed in the Conformance section. The name must be an XML name. To avoid possible conflicts, as a convention, names referring to features defined outside the DOM specification should be made unique by reversing the name of the Internet domain name of the person (or the organization that the person belongs to) who defines the feature, component by component, and using this as a prefix. For instance, the W3C SVG Working Group defines the feature “org.w3c.dom.svg”.versionof typeDOMString: This is the version number of the feature to test. In Level 2, the string can be either “2.0” or “1.0”. If the version is not specified, supporting any version of the feature causes the method to return true.
Return Value
boolean: true if the feature is implemented in the specified version, false otherwise.
No Exceptions
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".