List of usage examples for org.w3c.dom.ls DOMImplementationLS createLSInput
public LSInput createLSInput();
LSInput.characterStream
, LSInput.byteStream
, LSInput.stringData
LSInput.systemId
, LSInput.publicId
, LSInput.baseURI
, and LSInput.encoding
are null, and LSInput.certifiedText
is false. From source file:org.sonar.plugins.xml.schemas.SchemaResolver.java
private static LSInput createLSInput(InputStream inputStream) { if (inputStream != null) { System.setProperty(DOMImplementationRegistry.PROPERTY, "org.apache.xerces.dom.DOMImplementationSourceImpl"); try {/*from ww w. jav a 2 s. co m*/ DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementation impl = registry.getDOMImplementation("XML 1.0 LS 3.0"); DOMImplementationLS implls = (DOMImplementationLS) impl; LSInput lsInput = implls.createLSInput(); lsInput.setByteStream(inputStream); return lsInput; } catch (ClassNotFoundException e) { throw new SonarException(e); } catch (InstantiationException e) { throw new SonarException(e); } catch (IllegalAccessException e) { throw new SonarException(e); } } return null; }
From source file:org.xwiki.platform.patchservice.web.PatchServiceAction.java
private Document parseString(String content) { try {/*from www. ja v a 2 s . co 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; } }