Java XML SAX Parser getSchema(URL xml_schema)

Here you can find the source of getSchema(URL xml_schema)

Description

get Schema

License

Open Source License

Declaration

private static Schema getSchema(URL xml_schema) 

Method Source Code

//package com.java2s;
/**// ww w.jav a2  s.c  om
 * This file is part of tera-api.
 * 
 * tera-api is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * tera-api is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with tera-api.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.net.URL;
import javax.xml.XMLConstants;

import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;

import org.xml.sax.SAXException;

public class Main {
    private static Schema getSchema(URL xml_schema) {
        Schema schema = null;
        SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

        try {
            schema = sf.newSchema(xml_schema);
        } catch (SAXException saxe) {
            throw new Error("Error while getting schema", saxe);
        }

        return schema;
    }
}

Related

  1. getSAXParser()
  2. getSAXParser()
  3. getSAXParserFactory()
  4. getSAXSDDriver()
  5. getSchema(File xsd, ErrorHandler errorHandler)
  6. getSchemaFromResource(URL schemaURL)
  7. getXIncludeXMLReader()
  8. getXmlReader()
  9. isWellFormedXml(final String string)