parses a schema from the specified InputStream and returns a Verifier object
that validates documents by using that schema.
194037
public Verifier newVerifier(InputStream stream)
		throws VerifierConfigurationException, SAXException, IOException {
		
		return compileSchema( stream, null ).newVerifier();
	}
915759
function RawDecoder(schema, opts) {
  opts = opts || {};

  var noDecode = !!opts.noDecode;
  stream.Duplex.call(this, {
    readableObjectMode: !noDecode,
    allowHalfOpen: false
  });

  this._type = types.createType(files.load(schema));
  this._tap = new Tap(new Buffer(0));
  this._writeCb = null;
  this._needPush = false;
  this._readValue = createReader(noDecode, this._type);
  this._finished = false;

  this.on('finish', function () {
    this._finished = true;
    this._read();
  });
}
1039163
public TypeDefinitionRegistry parse(File file) throws SchemaProblem {
        try {
            return parse(Files.newBufferedReader(file.toPath(), defaultCharset()));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
93575
private static Document _loadDocument(InputStream is) throws SAXException, IOException {
	InputSource source = new InputSource(is);

	return XMLUtil.parse(source, null, false);
    }
237320
public VOMSResponse parse(InputStream inputStream) {

    try {

      Document document = docBuilder.parse(inputStream);

      return new RESTVOMSResponse(document);

    } catch (Exception e) {

      throw new VOMSError(e.getMessage());

    }
  }
731346
def load_schema(schema_ref,  # type: Union[CommentedMap, CommentedSeq, Text]
                cache=None   # type: Dict
                ):
    # type: (...) -> Tuple[Loader, Union[Names, SchemaParseException], Dict[Text, Any], Loader]
    

    metaschema_names, _metaschema_doc, metaschema_loader = get_metaschema()
    if cache is not None:
        metaschema_loader.cache.update(cache)
    schema_doc, schema_metadata = metaschema_loader.resolve_ref(schema_ref, "")

    if not isinstance(schema_doc, MutableSequence):
        raise ValueError("Schema reference must resolve to a list.")

    validate_doc(metaschema_names, schema_doc, metaschema_loader, True)
    metactx = schema_metadata.get("@context", {})
    metactx.update(collect_namespaces(schema_metadata))
    schema_ctx = jsonld_context.salad_to_jsonld_context(schema_doc, metactx)[0]

    # Create the loader that will be used to load the target document.
    document_loader = Loader(schema_ctx, cache=cache)

    # Make the Avro validation that will be used to validate the target
    # document
    avsc_names = make_avro_schema(schema_doc, document_loader)

    return document_loader, avsc_names, schema_metadata, metaschema_loader
919090
public JSONObject parseJSONSchema(JSONObject schema) throws Exception {
        JSONObject json = new JSONObject();
        String name = "";
        JSONObject properties = schema;

        // Check if key 'properties' exists
        if (schema.has("properties")) {
            // Obtain properties
            properties = schema.getJSONObject("properties");
        }

        // Obtain all keys and iterate through them
        Iterator<?> keys = properties.keys();
        while (keys.hasNext()) {
            // Obtain key
            String key = keys.next().toString();
            // Obtain value of key
            JSONObject element = properties.getJSONObject(key);
            // Check if value contain properties
            // If it DOESN'T CONTAIN properties
            if (!element.has("properties")) {
                // Check if it has default value
                if (element.has("default")) {
                    // Add element with the default value assigned
                    json.put(key, element.get("default"));
                // If it doesn't have default value, we assign a default value depending on the type
                } else {
                    switch (element.getString("type")) {
                        case "string":
                            json.put(key, "");
                            break;
                        case "boolean":
                            json.put(key, false);
                            break;
                        case "number": case "integer":
                            json.put(key, 0);
                            break;
                        default:
                            Assertions.fail("type not expected");
                    }
                }
            // If it CONTAINS properties
            } else {
                // Recursive call, keep evaluating json
                json.put(key, parseJSONSchema(element));
            }
        }

        return json;
    }
1200324
function parseValidateAttr(validateAttr, schema, validateFns) {

        // if an array, loop through and recurse
        if (_.isArray(validateAttr)) {
            _.each(validateAttr, function (validator) {
                parseValidateAttr(validator, schema, validateFns);
            });

            return;
        }

        // if validateAttr is a string, then assume it is field reference
        if (_.isString(validateAttr)) {
            _.extend(schema, getSchema(validateAttr));
        }
        else if (_.isFunction(validateAttr)) {
            validateFns.push(wrapFn(validateAttr));
        }
        else if (_.isObject(validateAttr)) {
            _.extend(schema,  validateAttr);
        }
    }
994525
public Object parse(InputStream inputStream) {
        if (inputStream == null) {
            throw new IllegalArgumentException("inputStream must not be null");
        }

        Object content;
        JsonParser parser = createParser();
        content = parser.parse(inputStream);
        return content;
    }
297989
public static DomDocument parseInputStream(DocumentBuilderFactory documentBuilderFactory, InputStream inputStream) {

    try {
      DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
      documentBuilder.setErrorHandler(new DomErrorHandler());
      return new DomDocumentImpl(documentBuilder.parse(inputStream));
    } catch (ParserConfigurationException e) {
      throw new ModelParseException("ParserConfigurationException while parsing input stream", e);

    } catch (SAXException e) {
      throw new ModelParseException("SAXException while parsing input stream", e);

    } catch (IOException e) {
      throw new ModelParseException("IOException while parsing input stream", e);

    }
  }
759251
public static Document documentFrom(InputStream is)
            throws SAXException, IOException, ParserConfigurationException {
        is = new NamespaceRemovingInputStream(is);
        // DocumentBuilderFactory is not thread safe
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        // ensure that parser writes error/warning messages to the logger
        // rather than stderr
        builder.setErrorHandler(ERROR_HANDLER);
        Document doc = builder.parse(is);
        is.close();
        return doc;
    }
852185
public static SshPrivateKeyFile parse(InputStream in) throws IOException {

		try {
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			int read;
			while ((read = in.read()) > -1) {
				out.write(read);
			}
			return parse(out.toByteArray());
		} finally {
			try {
				in.close();
			} catch (IOException ex) {
			}
		}

	}
609267
def validation_schema(name):
    """"""
    schemas = {
        'processor': 'processSchema.json',
        'descriptor': 'descriptorSchema.json',
        'field': 'fieldSchema.json',
        'type': 'typeSchema.json',
    }

    if name not in schemas:
        raise ValueError()

    field_schema_file = finders.find('flow/{}'.format(schemas['field']), all=True)[0]
    with open(field_schema_file, 'r') as fn:
        field_schema = fn.read()

    if name == 'field':
        return json.loads(field_schema.replace('{{PARENT}}', ''))

    schema_file = finders.find('flow/{}'.format(schemas[name]), all=True)[0]
    with open(schema_file, 'r') as fn:
        schema = fn.read()

    return json.loads(schema.replace('{{FIELD}}', field_schema).replace('{{PARENT}}', '/field'))
393601
public static Vector parseListFrom(final InputStream in, final Schema schema) 
    throws IOException
    {
        int size = in.read();
        if(size == -1)
            return new Vector();
        
        if(size > 0x7f)
            size = CodedInput.readRawVarint32(in, size);
        
        final Vector list = new Vector(size);
        final CodedInput input = new CodedInput(in, true);
        for(int i = 0; i < size; i++)
        {
            final Object message = schema.newMessage();
            list.addElement(message);
            schema.mergeFrom(input, message);
            input.checkLastTagWas(0);
        }
        
        //assert in.read() == -1;

        return list;
    }
1272714
private String parse(DocumentContext document) throws ParseException {
    if (document.namespaceDeclaration() != null) {
      setCurrentNamespace(
        document.namespaceDeclaration().qualifiedIdentifier().value);
    } else {
      setCurrentNamespace("");
    }

    setCurrentImports(document.importDeclarations());
    NamedDataSchema schema = parseNamedType(document.namedTypeDeclaration());
    topLevelSchemas.add(schema);
    return schema.getFullName();
  }
1112642
public static StreamSchema deserialize(String schemaString) {
    Iterable<String> fieldArray = Splitter.on(';').trimResults().omitEmptyStrings().split(schemaString);
    StreamSchema.Builder builder = new StreamSchema.Builder();
    for (String field : fieldArray) {
      Iterable<String> defnArray = Splitter.onPattern("\\s+").trimResults().omitEmptyStrings().split(field);
      List<String> defnList = Lists.newArrayList(defnArray);
      //We expect FieldType, FieldName (optional : FieldAttribute)
      Preconditions.checkArgument(defnList.size() >= 2);
      GDATFieldType type = GDATFieldType.getGDATFieldType(defnList.get(0).toUpperCase());
      String fieldName = defnList.get(1);
      builder.addField(fieldName, type);
    }
    return builder.build();
  }
742882
private void validate(Source src, Result res) throws XMLStreamException {
        try {
            Validator v = schemaFactory.newSchema().newValidator();
            v.setResourceResolver(schemaFactory.getResourceResolver());
            v.validate(src, res);
        } catch (SAXException | IOException e) {
            throw new XMLStreamException(e);
        }
    }