Returns the CycloneDX XML Schema for the specified schema version.
@param schemaVersion The version to return the schema for
@return a Schema
@throws SAXException a SAXException
@since 2.0.0
495413
public Schema getXmlSchema(CycloneDxSchema.Version schemaVersion) throws SAXException {
        if (CycloneDxSchema.Version.VERSION_10 == schemaVersion) {
            return getXmlSchema10();
        } else {
            return getXmlSchema11();
        }
    }
1056515
public static CathDatabase getCathDatabase(String version) {
		if (version == null) version = DEFAULT_VERSION;
		CathDatabase cath = versions.get(version);
		if (cath == null) {
			CathInstallation newCath = new CathInstallation();
			newCath.setCathVersion(version);
			cath = newCath;
		}
		return cath;
	}
1106791
public boolean recordVersion(String version) {
    if (currentInfo.documentVersion(version)) {
      populated = true;
      return true;
    } else {
      return false;
    }
  }
421287
public String getNumericVersionFromVersion(String version)
    {
        MessageVersion recMessageVersion = this.getMessageVersion(version);
        String numericVersion = DBConstants.BLANK;
        if ((recMessageVersion != null) && (!recMessageVersion.getField(MessageVersion.NAMESPACE).isNull()))
            numericVersion = recMessageVersion.getField(MessageVersion.NUMERIC_VERSION).toString();
        if ((numericVersion == null) || (numericVersion.length() == 0))
            numericVersion = "1.000";
        return numericVersion;
    }
1331413
public Schema createSchema(SAXSource source, PropertyMap properties) throws IOException, SAXException, IncorrectSchemaException {
    SchemaPatternBuilder spb = new SchemaPatternBuilder();
    SAXResolver resolver = ResolverFactory.createResolver(properties);
    ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER);
    DatatypeLibraryFactory dlf = properties.get(RngProperty.DATATYPE_LIBRARY_FACTORY);
    if (dlf == null) {
      //Create a new Data Type Library Loader
      dlf = new DatatypeLibraryLoader();
    }
    try {
      Pattern start = SchemaBuilderImpl.parse(createParseable(source, resolver, eh, properties), eh, dlf, spb,
          properties.contains(WrapProperty.ATTRIBUTE_OWNER));
      //Wrap the pattern
      return wrapPattern2(start, spb, properties);
    }
    catch (IllegalSchemaException e) {
      throw new IncorrectSchemaException();
    }
  }
756823
protected String getXMLVersion(Node nodeArg) {
        Document doc = null;
        
        // Determine the XML Version of the document
        if (nodeArg != null) {
            if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) {
                // The Document node is the Node argument
                doc = (Document)nodeArg;
            } else { 
                // The Document node is the Node argument's ownerDocument
                doc = nodeArg.getOwnerDocument();
            }
            
            // Determine the DOM Version.
            if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) {
                return doc.getXmlVersion();
            }
        } 
        // The version will be treated as "1.0" which may result in
        // an ill-formed document being serialized.
        // If nodeArg does not have an ownerDocument, treat this as XML 1.0
        return "1.0";
    }
607490
def get_schema_version_from_xml(xml):
    
    if isinstance(xml, six.string_types):
        xml = StringIO(xml)
    try:
        tree = ElementTree.parse(xml)
    except ParseError:
        # Not an XML file
        return None
    root = tree.getroot()
    return root.attrib.get('schemaVersion', None)
1220560
public void parseVersion( String version )
    {
        DefaultVersioning artifactVersion = new DefaultVersioning( version );

        getLog().debug( "Parsed Version" );
        getLog().debug( "         major: " + artifactVersion.getMajor() );
        getLog().debug( "         minor: " + artifactVersion.getMinor() );
        getLog().debug( "   incremental: " + artifactVersion.getPatch() );
        getLog().debug( "   buildnumber: " + artifactVersion.getBuildNumber() );
        getLog().debug( "     qualifier: " + artifactVersion.getQualifier() );

        defineVersionProperty( "majorVersion", artifactVersion.getMajor() );
        defineVersionProperty( "minorVersion", artifactVersion.getMinor() );
        defineVersionProperty( "incrementalVersion", artifactVersion.getPatch() );
        defineVersionProperty( "buildNumber", artifactVersion.getBuildNumber() );

        defineVersionProperty( "nextMajorVersion", artifactVersion.getMajor() + 1 );
        defineVersionProperty( "nextMinorVersion", artifactVersion.getMinor() + 1 );
        defineVersionProperty( "nextIncrementalVersion", artifactVersion.getPatch() + 1 );
        defineVersionProperty( "nextBuildNumber", artifactVersion.getBuildNumber() + 1 );

        defineFormattedVersionProperty( "majorVersion", String.format( formatMajor, artifactVersion.getMajor() ) );
        defineFormattedVersionProperty( "minorVersion", String.format( formatMinor, artifactVersion.getMinor() ) );
        defineFormattedVersionProperty( "incrementalVersion", String.format( formatIncremental, artifactVersion.getPatch() ) );
        defineFormattedVersionProperty( "buildNumber", String.format( formatBuildNumber, artifactVersion.getBuildNumber() ));

        defineFormattedVersionProperty( "nextMajorVersion", String.format( formatMajor, artifactVersion.getMajor() + 1 ));
        defineFormattedVersionProperty( "nextMinorVersion", String.format( formatMinor, artifactVersion.getMinor() + 1 ));
        defineFormattedVersionProperty( "nextIncrementalVersion", String.format( formatIncremental, artifactVersion.getPatch() + 1 ));
        defineFormattedVersionProperty( "nextBuildNumber", String.format( formatBuildNumber, artifactVersion.getBuildNumber() + 1 ));
        
        String osgi = artifactVersion.getAsOSGiVersion();

        String qualifier = artifactVersion.getQualifier();
        String qualifierQuestion = "";
        if ( qualifier == null )
        {
            qualifier = "";
        } else {
            qualifierQuestion = qualifierPrefix;
        }

        defineVersionProperty( "qualifier", qualifier );
        defineVersionProperty( "qualifier?", qualifierQuestion + qualifier );

        defineVersionProperty( "osgiVersion", osgi );
    }
497492
static BsonDocument getDocumentVersionDoc(final BsonDocument document) {
    if (document == null || !document.containsKey(DOCUMENT_VERSION_FIELD)) {
      return null;
    }
    return document.getDocument(DOCUMENT_VERSION_FIELD, null);
  }
531780
@Override
  public GenericRecord parse(ByteBuffer bytes)
  {
    if (bytes.remaining() < 5) {
      throw new ParseException("record must have at least 5 bytes carrying version and schemaId");
    }

    byte version = bytes.get();
    if (version != V1) {
      throw new ParseException("found record of arbitrary version [%s]", version);
    }

    int schemaId = bytes.getInt();
    Schema schemaObj = schemaObjs.get(schemaId);
    if (schemaObj == null) {
      throw new ParseException("Failed to find schema for id [%s]", schemaId);
    }

    DatumReader<GenericRecord> reader = new GenericDatumReader<>(schemaObj);
    try (ByteBufferInputStream inputStream = new ByteBufferInputStream(Collections.singletonList(bytes))) {
      return reader.read(null, DecoderFactory.get().binaryDecoder(inputStream, null));
    }
    catch (EOFException eof) {
      // waiting for avro v1.9.0 (#AVRO-813)
      throw new ParseException(
          eof,
          "Avro's unnecessary EOFException, detail: [%s]",
          "https://issues.apache.org/jira/browse/AVRO-813"
      );
    }
    catch (Exception e) {
      throw new ParseException(e, "Fail to decode avro message with schemaId [%s].", schemaId);
    }
  }
516968
public static String getFormatVersion(File filename) {
		final ContentFileTypeMap map = ensureContentTypeManager();
		return map.getFormatVersion(filename);
	}
299416
private Path getVersionRoot(String version) throws VersionDoesNotExistException {

    try {
      return this.versions.get(version, new VersionRootLoader(version));
    } catch (ExecutionException e) {
      throw new RuntimeException(
          String.format("Error while checking if version \"%s\" for store \"%s\" exists", version, getStoreURI()), e);
    }
  }
898482
public static String validateXMLAgainstSchema(final String xml) {
		// Validate XML against schema
		if (xml != null && !xml.equals("")) {
			// Wrap XML with a root element (if required)
			String testXML = wrapXMLInRootElement(xml);
			try {
				// Create SAX Parser Factory
				SAXParserFactory spf = SAXParserFactory.newInstance();
				spf.setNamespaceAware(true);
				spf.setValidating(true);

				// Create SAX Parser
				SAXParser parser = spf.newSAXParser();
				parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
						XMLConstants.W3C_XML_SCHEMA_NS_URI);

				// Set schema location
				Object schema = DebugValidateXML.class.getResource(getSchemaPath()).toString();
				parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schema);

				// Setup the handler to throw an exception when an error occurs
				DefaultHandler handler = new DefaultHandler() {
					@Override
					public void warning(final SAXParseException e) throws SAXException {
						LOG.warn("XML Schema warning: " + e.getMessage(), e);
						super.warning(e);
					}

					@Override
					public void fatalError(final SAXParseException e) throws SAXException {
						throw e;
					}

					@Override
					public void error(final SAXParseException e) throws SAXException {
						throw e;
					}
				};

				// Validate the XML
				InputSource xmlSource = new InputSource(new StringReader(testXML));
				parser.parse(xmlSource, handler);

			} catch (SAXParseException e) {
				return "At line " + e.getLineNumber() + ", column: " + e.getColumnNumber()
						+ " ==> " + e.getMessage();
			} catch (Exception e) {
				return e.getMessage();
			}
		}

		return null;
	}
227409
String processVersion(String version) {
    if (version == null || version.trim().isEmpty() || version.equals(APPENGINE_CONFIG)) {
      throw new IllegalArgumentException(VERSION_ERROR);
    } else if (version.equals(GCLOUD_CONFIG)) {
      return null;
    }
    return version;
  }
937232
function(xml, command, version) {
		var formatVersion = version || JSDAS.Formats.current;
		var format = JSDAS.Formats[formatVersion][command];
		var json = JSDAS.Parser.parseElement(xml, format);
		return json;
	}
192322
function (version) {
  var that = this;
  var createValidators = function (spec, validatorsMap) {
    return _.reduce(validatorsMap, function (result, schemas, schemaName) {
      result[schemaName] = helpers.createJsonValidator(schemas);

      return result;
    }, {});
  };
  var fixSchemaId = function (schemaName) {
    // Swagger 1.2 schema files use one id but use a different id when referencing schema files.  We also use the schema
    // file name to reference the schema in ZSchema.  To fix this so that the JSON Schema validator works properly, we
    // need to set the id to be the name of the schema file.
    var fixed = _.cloneDeep(that.schemas[schemaName]);

    fixed.id = schemaName;

    return fixed;
  };
  var primitives = ['string', 'number', 'boolean', 'integer', 'array'];

  switch (version) {
  case '1.2':
    this.docsUrl = 'https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md';
    this.primitives = _.union(primitives, ['void', 'File']);
    this.schemasUrl = 'https://github.com/swagger-api/swagger-spec/tree/master/schemas/v1.2';

    // Here explicitly to allow browserify to work
    this.schemas = {
      'apiDeclaration.json': require('../schemas/1.2/apiDeclaration.json'),
      'authorizationObject.json': require('../schemas/1.2/authorizationObject.json'),
      'dataType.json': require('../schemas/1.2/dataType.json'),
      'dataTypeBase.json': require('../schemas/1.2/dataTypeBase.json'),
      'infoObject.json': require('../schemas/1.2/infoObject.json'),
      'modelsObject.json': require('../schemas/1.2/modelsObject.json'),
      'oauth2GrantType.json': require('../schemas/1.2/oauth2GrantType.json'),
      'operationObject.json': require('../schemas/1.2/operationObject.json'),
      'parameterObject.json': require('../schemas/1.2/parameterObject.json'),
      'resourceListing.json': require('../schemas/1.2/resourceListing.json'),
      'resourceObject.json': require('../schemas/1.2/resourceObject.json')
    };

    this.validators = createValidators(this, {
      'apiDeclaration.json': _.map([
        'dataTypeBase.json',
        'modelsObject.json',
        'oauth2GrantType.json',
        'authorizationObject.json',
        'parameterObject.json',
        'operationObject.json',
        'apiDeclaration.json'
      ], fixSchemaId),
      'resourceListing.json': _.map([
        'resourceObject.json',
        'infoObject.json',
        'oauth2GrantType.json',
        'authorizationObject.json',
        'resourceListing.json'
      ], fixSchemaId)
    });

    break;

  case '2.0':
    this.docsUrl = 'https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md';
    this.primitives = _.union(primitives, ['file']);
    this.schemasUrl = 'https://github.com/swagger-api/swagger-spec/tree/master/schemas/v2.0';

    // Here explicitly to allow browserify to work
    this.schemas = {
      'schema.json': require('../schemas/2.0/schema.json')
    };

    this.validators = createValidators(this, {
      'schema.json': [fixSchemaId('schema.json')]
    });

    break;

  default:
    throw new Error(version + ' is an unsupported Swagger specification version');
  }

  this.version = version;
}
281496
public CloudSdkVersion getVersion() throws CloudSdkVersionFileException {
    Path versionFile = getPath().resolve(VERSION_FILE_NAME);

    if (!Files.isRegularFile(versionFile)) {
      throw new CloudSdkVersionFileNotFoundException(
          "Cloud SDK version file not found at " + versionFile.toString());
    }

    String contents = "";
    try {
      List<String> lines = Files.readAllLines(versionFile, StandardCharsets.UTF_8);
      if (lines.size() > 0) {
        // expect only a single line
        contents = lines.get(0);
      }
      return new CloudSdkVersion(contents);
    } catch (IOException ex) {
      throw new CloudSdkVersionFileException(ex);
    } catch (IllegalArgumentException ex) {
      throw new CloudSdkVersionFileParseException(
          "Pattern found in the Cloud SDK version file could not be parsed: " + contents, ex);
    }
  }