DOM Level 3 has introduced specification to load (save), parse and serialize XML documents.

The DOM level 3 load and save have two parsing modes: synchronous and asynchronous. The properties and methods added to the document.implementation method object are:

MODE_SYNCHRONOUS

This constant states that the parsing mode is synchronous.

MODE_ASYNCHRONOUS

This constant states that the parsing mode is synchronous.

createLSParser(mode, schemaType)

Creates a new load and save parser of ‘mode’ and ‘schemaType’ passed as argument.

Example

var impl = document.implementation;

var parser = impl.createLSParser(impl.MODE_SYNCHRONOUS, null);

createLSSerializer()

Creates a new XML serializer.

Example

var serializer = impl.createLSSerializer();

createLSInput()

Creates a new input object on which parsing and serializing can be done.

Example

var input = impl.createLSInput();

createLSOutput()

Creates a new output object for parsing and serializing operation.

Example

var output = impl.createLSOutput();

hasFeature()

These methods are not widely supported. These methods are supported only in Opera browser till now. To determine if the method is supported or not a hasFeature() can be used as shown below:

Syntax for hasFeature()

var hasLS = document.implementation.hasFeature(“LS”, “3.0”);

var hasLS = document.implementation.hasFeature(“LS-Async”, “3.0”);

 

›› go to examples ››