Code example for Validator

Methods: validate

0
 
            // Reset the stream if it supports that operation. 
            xml.reset();
 
            // Validation throws a bunch of possible Exceptions on failure. 
            validator.validate(new StreamSource(xml));
            return SdkAddonsListConstants.getSchemaUri(version);
 
        } catch (SAXParseException e) {
            outError[0] = String.format(
                    "XML verification failed for %1$s.\nLine %2$d:%3$d, Error: %4$s", 
                    url,
                    e.getLineNumber(),
                    e.getColumnNumber(),
                    e.toString());
 
        } catch (Exception e) {
            outError[0] = String.format(
                    "XML verification failed for %1$s.\nError: %2$s", 
                    url,
                    e.toString());