Code example for StreamSource

Methods: getReader

import org.xml.sax.XMLReader; 
public class CwrcXmlValidator { 
    public Document ValidateDocInUrl(String schemaUrl, String documentUrl, String schemaType) {
        StreamSource document = new StreamSource(documentUrl);
        return Validate(schemaUrl, document.getReader(), schemaType);
    public Document ValidateDocContent(String schemaUrl, String documentContent, String schemaType) {
        documentContent = CharMatcher.WHITESPACE.trimFrom(documentContent);
        //StringReader reader = new StringReader(documentContent); 
        //StreamSource document = new StreamSource(reader); 
        StringReader document = new StringReader(documentContent);
        return Validate(schemaUrl, document, schemaType);
    public Document Validate(String schemaUrl, Reader document, String schemaType) {
        CwrcValidationReport error_report = new CwrcValidationReport();
        CwrcXmlContentHandler content_handler = new CwrcXmlContentHandler();
Connect your IDE to all the code out there  Get Codota for Java