[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit HttpUnitUtils.java,1.6,1.7
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-02-01 14:21:39
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv5756/src/com/meterware/httpunit
Modified Files:
HttpUnitUtils.java
Log Message:
From Jochen Hiller: use JAXP-compliant parser for ServletUnit
Index: HttpUnitUtils.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- HttpUnitUtils.java 2002/01/10 15:42:00 1.6
+++ HttpUnitUtils.java 2002/02/01 14:21:35 1.7
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
-* Copyright (c) 2000-2001, Russell Gold
+* Copyright (c) 2000-2002, Russell Gold
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@@ -21,6 +21,12 @@
*******************************************************************************************************************/
import java.util.StringTokenizer;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.xml.sax.SAXException;
+
/**
* Utility code shared by httpunit and servletunit.
**/
@@ -79,5 +85,19 @@
}
}
return sb.toString();
+ }
+
+
+ /**
+ * creates a parser using JAXP API.
+ */
+ public static DocumentBuilder newParser() throws SAXException {
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ return factory.newDocumentBuilder();
+ } catch (ParserConfigurationException ex) {
+ // redirect the new exception for code compatibility
+ throw new SAXException( ex );
+ }
}
}
|