[][src]Trait xml_dom::level2::DOMImplementation

pub trait DOMImplementation {
    type NodeRef;
    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; }

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.

Associated Types

type NodeRef

The opaque reference type that wraps the implementation of a node within the DOM.

Loading content...

Required methods

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.

Specification

HTML-only DOM implementations do not need to implement this method. Introduced in DOM Level 2

Parameters

  • namespaceURI of type DOMString: The namespace URI of the document element to create.
  • qualifiedName of type DOMString: The qualified name of the document element to be created.
  • doctype of type DocumentType: 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.

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

  • qualifiedName of type DOMString: The qualified name of the document type to be created.
  • publicId of type DOMString: The external subset public identifier.
  • systemId of type DOMString: 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 the qualifiedName is malformed.

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

  • feature of type DOMString: 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".
  • version of type DOMString: 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

Loading content...

Trait Implementations

impl Debug for &'static dyn DOMImplementation<NodeRef = RefNode>[src]

Implementors

Loading content...