Example usage for org.w3c.dom.ls DOMImplementationLS createLSParser

List of usage examples for org.w3c.dom.ls DOMImplementationLS createLSParser

Introduction

In this page you can find the example usage for org.w3c.dom.ls DOMImplementationLS createLSParser.

Prototype

public LSParser createLSParser(short mode, String schemaType) throws DOMException;

Source Link

Document

Create a new LSParser.

Usage

From source file:org.xwiki.platform.patchservice.web.PatchServiceAction.java

private Document parseString(String content) {
    try {//  w  ww  .j  a  va  2s  . c  o m
        DOMImplementationLS lsImpl = (DOMImplementationLS) DOMImplementationRegistry.newInstance()
                .getDOMImplementation("LS 3.0");
        LSInput input = lsImpl.createLSInput();
        input.setCharacterStream(new StringReader(content));
        LSParser p = lsImpl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
        return p.parse(input);
    } catch (Exception ex) {
        return null;
    }
}