Package org.apache.xmlbeans.impl.validator

Examples of org.apache.xmlbeans.impl.validator.ValidatingXMLStreamReader$ElementEventImpl


    public static void validateFiles(File[] instanceFiles,
                                     SchemaTypeLoader sLoader,
                                     final XmlOptions options)
    {
        final ValidatingXMLStreamReader vsr = new ValidatingXMLStreamReader();
        final Collection errors = new ArrayList();

        for (int i = 0; i < instanceFiles.length; i++) {
            final File file = instanceFiles[i];
            final String path = file.getPath();
            long time = 0;

            errors.clear();

            try {
                final FileInputStream fis = new FileInputStream(file);
                final XMLStreamReader rdr =
                    XML_INPUT_FACTORY.createXMLStreamReader(path, fis);

                //advance to first start element.
                while(!rdr.isStartElement()) {
                    rdr.next();
                }

                time = System.currentTimeMillis();
                vsr.init(rdr, true, null, sLoader, options, errors);

                while (vsr.hasNext()) {
                    vsr.next();
                }

                time = (System.currentTimeMillis() - time);
                vsr.close();
                fis.close();
            }
            catch (XMLStreamException xse) {
                final Location loc = xse.getLocation();
                XmlError e = XmlError.forLocation(xse.getMessage(), path,
View Full Code Here


    public static void validateFiles(File[] instanceFiles,
                                     SchemaTypeLoader sLoader,
                                     final XmlOptions options)
    {
        final ValidatingXMLStreamReader vsr = new ValidatingXMLStreamReader();
        final Collection errors = new ArrayList();

        for (int i = 0; i < instanceFiles.length; i++) {
            final File file = instanceFiles[i];
            final String path = file.getPath();
            long time = 0;

            errors.clear();

            try {
                final FileInputStream fis = new FileInputStream(file);
                final XMLStreamReader rdr =
                    XML_INPUT_FACTORY.createXMLStreamReader(path, fis);

                //advance to first start element.
                while(!rdr.isStartElement()) {
                    rdr.next();
                }

                time = System.currentTimeMillis();
                vsr.init(rdr, true, null, sLoader, options, errors);
               
                while (vsr.hasNext()) {
                    vsr.next();
                }

                time = (System.currentTimeMillis() - time);
                vsr.close();
                fis.close();
            }
            catch (XMLStreamException xse) {
                final Location loc = xse.getLocation();
                XmlError e = XmlError.forLocation(xse.getMessage(), path,
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.impl.validator.ValidatingXMLStreamReader$ElementEventImpl

Copyright © 2018 www.massapicom. 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.