Here you can find the source of newSchema(File xmlSchema)
Parameter | Description |
---|---|
xmlSchema | a parameter |
public static Schema newSchema(File xmlSchema)
//package com.java2s; //License from project: Apache License import java.io.File; import javax.xml.transform.Source; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import org.xml.sax.SAXException; public class Main { /**/*from w w w . j a va 2 s . c o m*/ * Schema factory */ private static final SchemaFactory W3X_XML_SCHEMA_FACTORY = SchemaFactory .newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI); /** * Creates a new Schema using the default XML implementation * * @param xmlSchema * @return Schema */ public static Schema newSchema(File xmlSchema) { try { return W3X_XML_SCHEMA_FACTORY.newSchema(xmlSchema); } catch (SAXException e) { throw new RuntimeException("Could not create schema for file '" + xmlSchema.getName() + "'!", e); } } /** * Creates a new Schema using the default XML implementation * * @param xmlSchema * @return Schema */ public static Schema newSchema(Source xmlSchema) { try { return W3X_XML_SCHEMA_FACTORY.newSchema(xmlSchema); } catch (SAXException e) { throw new RuntimeException("Could not create schema for file '" + xmlSchema + "'!", e); } } }