mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-02-25 03:45:16 +01:00
resolved merge conflicts
This commit is contained in:
@@ -61,7 +61,7 @@ public final class XmlUtils {
|
||||
/**
|
||||
* Constructs a validating secure SAX Parser.
|
||||
*
|
||||
* @param schemaStream the schema to validate the XML against
|
||||
* @param schemaStream One or more inputStreams with the schema(s) that the parser should be able to validate the XML against, one InputStream per schema
|
||||
* @return a SAX Parser
|
||||
* @throws ParserConfigurationException is thrown if there is a parser
|
||||
* configuration exception
|
||||
@@ -71,7 +71,7 @@ public final class XmlUtils {
|
||||
* feature
|
||||
* @throws SAXException is thrown if there is a SAXException
|
||||
*/
|
||||
public static SAXParser buildSecureSaxParser(InputStream schemaStream) throws ParserConfigurationException,
|
||||
public static SAXParser buildSecureSaxParser(InputStream... schemaStream) throws ParserConfigurationException,
|
||||
SAXNotRecognizedException, SAXNotSupportedException, SAXException {
|
||||
final SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
@@ -87,6 +87,32 @@ public final class XmlUtils {
|
||||
return saxParser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an attribute value representing an xsd:boolean value to a boolean using
|
||||
* the rules as stated in the XML specification
|
||||
*
|
||||
* @param lexicalXSDBoolean The string-value of the boolean
|
||||
* @return the boolean value represented by {@code lexicalXSDBoolean}
|
||||
* @throws IllegalArgumentException When {@code lexicalXSDBoolean} does
|
||||
* fit the lexical space of the XSD boolean datatype
|
||||
*/
|
||||
public static boolean parseBoolean(String lexicalXSDBoolean) {
|
||||
final boolean result;
|
||||
switch (lexicalXSDBoolean) {
|
||||
case "true":
|
||||
case "1":
|
||||
result = true;
|
||||
break;
|
||||
case "false":
|
||||
case "0":
|
||||
result = false;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("'"+lexicalXSDBoolean+"' is not a valid xs:boolean value");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a secure SAX Parser.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user