--- a/rdfxml/src/main/scala/RDFXML.scala Thu Dec 02 12:54:12 2010 -0500
+++ b/rdfxml/src/main/scala/RDFXML.scala Thu Dec 02 16:46:04 2010 -0500
@@ -40,13 +40,13 @@
}
sealed trait ParseErrorType
-object RDFParseError extends ParseErrorType
-object XMLParseError extends ParseErrorType
+object RDFParseError extends ParseErrorType { override def toString:String = "RDF" }
+object XMLParseError extends ParseErrorType { override def toString:String = "XML" }
sealed trait ParseErrorLevel
-object FatalError extends ParseErrorLevel
-object Error extends ParseErrorLevel
-object Warning extends ParseErrorLevel
+object FatalError extends ParseErrorLevel { override def toString:String = "FatalError" }
+object Error extends ParseErrorLevel { override def toString:String = "Error" }
+object Warning extends ParseErrorLevel { override def toString:String = "Warning" }
case class ParseError(
val message:String,
@@ -57,7 +57,11 @@
def fromSAXParseException(e:SAXParseException, level:ParseErrorLevel):ParseError = {
val message = e.getMessage
val errorType = if (e.isInstanceOf[ParseException]) RDFParseError else XMLParseError
- new ParseError(message, errorType, level)
+ val correctedLevel =
+ if (message.size > 1 && message(1) == 'W') Warning
+ else if (message.size > 1 && message(1) == 'E') Error
+ else level
+ new ParseError(message, errorType, correctedLevel)
}
}