Package org.owasp.dependencycheck.utils
Class XmlUtils
- java.lang.Object
 - 
- org.owasp.dependencycheck.utils.XmlUtils
 
 
- 
public final class XmlUtils extends java.lang.ObjectCollection of XML related code.- Version:
 - $Id: $Id
 - Author:
 - Jeremy Long
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.lang.StringJAXP_SCHEMA_LANGUAGEJAXP Schema Language.static java.lang.StringJAXP_SCHEMA_SOURCEJAXP Schema Source.static java.lang.StringW3C_XML_SCHEMAW3C XML Schema. 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.xml.parsers.DocumentBuilderbuildSecureDocumentBuilder()Constructs a new document builder with security features enabled.static javax.xml.parsers.SAXParserbuildSecureSaxParser()Constructs a secure SAX Parser.static javax.xml.parsers.SAXParserbuildSecureSaxParser(java.io.InputStream... schemaStream)Constructs a validating secure SAX Parser.static java.lang.StringgetPrettyParseExceptionInfo(org.xml.sax.SAXParseException ex)Builds a prettier exception message.static booleanparseBoolean(java.lang.String lexicalXSDBoolean)Converts an attribute value representing an xsd:boolean value to a boolean using the rules as stated in the XML specification. 
 - 
 
- 
- 
Field Detail
- 
JAXP_SCHEMA_LANGUAGE
public static final java.lang.String JAXP_SCHEMA_LANGUAGE
JAXP Schema Language. Source: http://docs.oracle.com/javase/tutorial/jaxp/sax/validation.html- See Also:
 - Constant Field Values
 
 
- 
W3C_XML_SCHEMA
public static final java.lang.String W3C_XML_SCHEMA
W3C XML Schema. Source: http://docs.oracle.com/javase/tutorial/jaxp/sax/validation.html- See Also:
 - Constant Field Values
 
 
- 
JAXP_SCHEMA_SOURCE
public static final java.lang.String JAXP_SCHEMA_SOURCE
JAXP Schema Source. Source: http://docs.oracle.com/javase/tutorial/jaxp/sax/validation.html- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
buildSecureSaxParser
public static javax.xml.parsers.SAXParser buildSecureSaxParser(java.io.InputStream... schemaStream) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException, org.xml.sax.SAXExceptionConstructs a validating secure SAX Parser.- Parameters:
 schemaStream- One or more inputStreams with the schema(s) that the parser should be able to validate the XML against, one InputStream per schema- Returns:
 - a SAX Parser
 - Throws:
 javax.xml.parsers.ParserConfigurationException- is thrown if there is a parser configuration exceptionorg.xml.sax.SAXNotRecognizedException- thrown if there is an unrecognized featureorg.xml.sax.SAXNotSupportedException- thrown if there is a non-supported featureorg.xml.sax.SAXException- is thrown if there is a org.xml.sax.SAXException
 
- 
parseBoolean
public static boolean parseBoolean(java.lang.String lexicalXSDBoolean)
Converts an attribute value representing an xsd:boolean value to a boolean using the rules as stated in the XML specification.- Parameters:
 lexicalXSDBoolean- The string-value of the boolean- Returns:
 - the boolean value represented by 
lexicalXSDBoolean - Throws:
 java.lang.IllegalArgumentException- WhenlexicalXSDBooleandoes fit the lexical space of the XSD boolean datatype
 
- 
buildSecureSaxParser
public static javax.xml.parsers.SAXParser buildSecureSaxParser() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException, org.xml.sax.SAXExceptionConstructs a secure SAX Parser.- Returns:
 - a SAX Parser
 - Throws:
 javax.xml.parsers.ParserConfigurationException- thrown if there is a parser configuration exceptionorg.xml.sax.SAXNotRecognizedException- thrown if there is an unrecognized featureorg.xml.sax.SAXNotSupportedException- thrown if there is a non-supported featureorg.xml.sax.SAXException- is thrown if there is a org.xml.sax.SAXException
 
- 
buildSecureDocumentBuilder
public static javax.xml.parsers.DocumentBuilder buildSecureDocumentBuilder() throws javax.xml.parsers.ParserConfigurationExceptionConstructs a new document builder with security features enabled.- Returns:
 - a new document builder
 - Throws:
 javax.xml.parsers.ParserConfigurationException- thrown if there is a parser configuration exception
 
- 
getPrettyParseExceptionInfo
public static java.lang.String getPrettyParseExceptionInfo(org.xml.sax.SAXParseException ex)
Builds a prettier exception message.- Parameters:
 ex- the SAXParseException- Returns:
 - an easier to read exception message
 
 
 - 
 
 -