Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.InputStream;

import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;

import org.xml.sax.SAXException;

public class Main {
    public static Schema getSchema(InputStream... inputs) throws SAXException {
        StreamSource[] streamSource = new StreamSource[inputs.length];

        for (int i = 0; i < inputs.length; i++) {
            streamSource[i] = new StreamSource(inputs[i]);
        }

        SchemaFactory sf = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = sf.newSchema(streamSource);

        return schema;
    }
}