Package javax.xml.validation

Examples of javax.xml.validation.Schema.newValidatorHandler()


    public XMLReaderAdapter(XMLUnmarshaller xmlUnmarshaller) {
      super();
        if(null != xmlUnmarshaller) {
            Schema schema = xmlUnmarshaller.getSchema();
            if(null != schema) {
                validatingContentHandler = new ValidatingContentHandler(schema.newValidatorHandler());
                this.contentHandler = new ExtendedContentHandlerAdapter(validatingContentHandler);
            }
            setErrorHandler(xmlUnmarshaller.getErrorHandler());
        }
    }
View Full Code Here


    }
   
    private void setValidatorHandler(XMLReader xmlReader) {
        Schema schema = getSchema();
        if (null != schema) {
            ValidatorHandler validatorHandler = schema.newValidatorHandler();
            xmlReader.setValidatorHandler(validatorHandler);
            validatorHandler.setErrorHandler(getErrorHandler());
        }
    }
View Full Code Here

    }
   
    private void setValidatorHandler(XMLReader xmlReader) {
        Schema schema = getSchema();
        if (null != schema) {
            ValidatorHandler validatorHandler = schema.newValidatorHandler();
            xmlReader.setValidatorHandler(validatorHandler);
            validatorHandler.setErrorHandler(getErrorHandler());
        }
    }
View Full Code Here

    public XMLReaderAdapter(XMLUnmarshaller xmlUnmarshaller) {
        if(null != xmlUnmarshaller) {
            Schema schema = xmlUnmarshaller.getSchema();
            if(null != schema) {
                validatorHandler = schema.newValidatorHandler();
                this.contentHandler = new ExtendedContentHandlerAdapter(validatorHandler);
            }
            setErrorHandler(xmlUnmarshaller.getErrorHandler());
        }
    }
View Full Code Here

            else {
                schema = factory.newSchema();
            }
           
            // Setup validator and parser
            ValidatorHandler validator = schema.newValidatorHandler();
            parser.setContentHandler(validator);
            if (validator instanceof DTDHandler) {
                parser.setDTDHandler((DTDHandler) validator);
            }
            parser.setErrorHandler(writer);
View Full Code Here

            }

            Resolver resolver = new Resolver();

            //create a validator to validate against the schema.
            ValidatorHandler schemaValidator = schemaGrammar.newValidatorHandler();
            schemaValidator.setResourceResolver(resolver);
            schemaValidator.setErrorHandler(errorHandler);
            schemaValidator.setContentHandler(new LocalContentHandler(schemaValidator.getTypeInfoProvider()));

            System.err.println("Validating "+args[1] +" against grammar "+args[0]);
View Full Code Here

                this.namespaceURI = uri;
                InputStream schemaStream = findSchemaFromNamespaceURI(uri);
                XMLSchemaFactory sf = new XMLSchemaFactory(); // Xerces
                Schema schema = sf.newSchema(new StreamSource(schemaStream));
                this.vHandler = schema.newValidatorHandler();

                configHandler = new XmlConfigHandler(vHandler.getTypeInfoProvider());
                vHandler.setContentHandler(configHandler);
                vHandler.setErrorHandler(this);
View Full Code Here

    }
   
    private void setValidatorHandler(XMLReader xmlReader) {
        Schema schema = getSchema();
        if (null != schema) {
            ValidatorHandler validatorHandler = schema.newValidatorHandler();
            xmlReader.setValidatorHandler(validatorHandler);
            validatorHandler.setErrorHandler(getErrorHandler());
        }
    }
View Full Code Here

    private ContentHandlerRecord validatingRecord;

    public ValidatingMarshalRecord(MarshalRecord marshalRecord, XMLMarshaller xmlMarshaller) {
        this.marshalRecord = marshalRecord;
        Schema schema = xmlMarshaller.getSchema();
        ValidatorHandler validatorHandler = schema.newValidatorHandler();
        validatorHandler.setErrorHandler(new ValidatingMarshalRecordErrorHandler(marshalRecord, xmlMarshaller.getErrorHandler()));
        if(xmlMarshaller.isFragment()) {
            try {
                validatorHandler.startDocument();
            } catch (SAXException e) {
View Full Code Here

    public XMLReaderAdapter(XMLUnmarshaller xmlUnmarshaller) {
      super();
        if(null != xmlUnmarshaller) {
            Schema schema = xmlUnmarshaller.getSchema();
            if(null != schema) {
                validatingContentHandler = new ValidatingContentHandler(schema.newValidatorHandler());
                this.contentHandler = new ExtendedContentHandlerAdapter(validatingContentHandler);
            }
            setErrorHandler(xmlUnmarshaller.getErrorHandler());
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.