javax.xml.validation.TypeInfoProvider Java Examples

The following examples show how to use javax.xml.validation.TypeInfoProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeInfoProviderTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    TypeInfoProvider typeInfoProvider = validatorHandler.getTypeInfoProvider();
    int index = atts.getIndex("orderid");
    if (index != -1) {
        System.out.println(" Index " + index);
        System.out.println(" ElementType " + typeInfoProvider.getElementTypeInfo().getTypeName());
        assertEquals(typeInfoProvider.getAttributeTypeInfo(index).getTypeName(), "string");
        assertTrue(typeInfoProvider.isSpecified(index));
        assertFalse(typeInfoProvider.isIdAttribute(index));
    }

}
 
Example #2
Source File: Bug4969732.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test1() throws Exception {
    XMLReader xmlReader = createXMLReader();
    final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
    xmlReader.setContentHandler(validatorHandler);

    DefaultHandler handler = new DefaultHandler() {
        public void characters(char[] ch, int start, int length) throws SAXException {
            TypeInfoProvider infoProvider = null;
            synchronized (validatorHandler) {
                infoProvider = validatorHandler.getTypeInfoProvider();
            }
            if (infoProvider == null) {
                Assert.fail("Can't obtain TypeInfo object.");
            }

            try {
                infoProvider.getElementTypeInfo();
                Assert.fail("IllegalStateException was not thrown.");
            } catch (IllegalStateException e) {
                // as expected
                System.out.println("OK");
            }
        }
    };
    validatorHandler.setContentHandler(handler);

    parse(xmlReader, XML);
}
 
Example #3
Source File: Bug4970951.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test() throws Exception {
    XMLReader xmlReader = createXMLReader();
    final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
    xmlReader.setContentHandler(validatorHandler);

    DefaultHandler handler = new DefaultHandler() {
        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
            if (!"ns:test".equals(qName)) {
                return;
            }

            TypeInfoProvider infoProvider = validatorHandler.getTypeInfoProvider();
            if (infoProvider == null) {
                throw new SAXException("Can't obtain TypeInfoProvider object.");
            }

            int index = attributes.getIndex("id");
            if (index == -1) {
                throw new SAXException("The attribute 'id' is not in the list.");
            }

            Assert.assertTrue(infoProvider.isSpecified(index));

            index = attributes.getIndex("date");
            if (index == -1) {
                throw new SAXException("The attribute 'date' is not in the list.");
            }

            Assert.assertFalse(infoProvider.isSpecified(index));

            System.out.println("OK");
        }
    };
    validatorHandler.setContentHandler(handler);

    parse(xmlReader, XML);
}
 
Example #4
Source File: ValidatorHandlerImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #5
Source File: JAXPValidatorComponent.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #6
Source File: ValidatorHandlerImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #7
Source File: JAXPValidatorComponent.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #8
Source File: ValidatorHandlerImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #9
Source File: JAXPValidatorComponent.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #10
Source File: ValidatorHandlerImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #11
Source File: JAXPValidatorComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #12
Source File: ValidatorHandlerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #13
Source File: JAXPValidatorComponent.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #14
Source File: ValidatorHandlerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #15
Source File: JAXPValidatorComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #16
Source File: ValidatorHandlerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #17
Source File: JAXPValidatorComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #18
Source File: ValidatorHandlerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #19
Source File: JAXPValidatorComponent.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #20
Source File: ValidatorHandlerImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #21
Source File: JAXPValidatorComponent.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #22
Source File: ValidatorHandlerImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #23
Source File: JAXPValidatorComponent.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}
 
Example #24
Source File: ValidatorHandlerImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public TypeInfoProvider getTypeInfoProvider() {
    return fTypeInfoProvider;
}
 
Example #25
Source File: JAXPValidatorComponent.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * @param validatorHandler may not be null.
 */
public JAXPValidatorComponent( ValidatorHandler validatorHandler ) {
    this.validator = validatorHandler;
    TypeInfoProvider tip = validatorHandler.getTypeInfoProvider();
    if(tip==null)   tip = noInfoProvider;
    this.typeInfoProvider = tip;

    // configure wiring between internal components.
    xni2sax.setContentHandler(validator);
    validator.setContentHandler(sax2xni);
    this.setSide(xni2sax);

    // configure validator with proper EntityResolver/ErrorHandler.
    validator.setErrorHandler(new ErrorHandlerProxy() {
        protected XMLErrorHandler getErrorHandler() {
            XMLErrorHandler handler = fErrorReporter.getErrorHandler();
            if(handler!=null)   return handler;
            return new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
        }
    });
    validator.setResourceResolver(new LSResourceResolver() {
        public LSInput resolveResource(String type,String ns, String publicId, String systemId, String baseUri) {
            if(fEntityResolver==null)   return null;
            try {
                XMLInputSource is = fEntityResolver.resolveEntity(
                    new XMLResourceIdentifierImpl(publicId,systemId,baseUri,null));
                if(is==null)    return null;

                LSInput di = new DOMInputImpl();
                di.setBaseURI(is.getBaseSystemId());
                di.setByteStream(is.getByteStream());
                di.setCharacterStream(is.getCharacterStream());
                di.setEncoding(is.getEncoding());
                di.setPublicId(is.getPublicId());
                di.setSystemId(is.getSystemId());

                return di;
            } catch( IOException e ) {
                // erors thrown by the callback is not supposed to be
                // reported to users.
                throw new XNIException(e);
            }
        }
    });
}