svn commit: r13274 - trunk/src_new/org/argouml/persistence/SAXParserBase.java
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: tfmorris
Date: 2007-08-09 12:31:25-0700
New Revision: 13274
Modified:
trunk/src_new/org/argouml/persistence/SAXParserBase.java
Log:
Add parse(InputSource) as alternative to parse(Reader)
Modified: trunk/src_new/org/argouml/persistence/SAXParserBase.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/SAXParserBase.java?view=diff&rev=13274&p1=trunk/src_new/org/argouml/persistence/SAXParserBase.java&p2=trunk/src_new/org/argouml/persistence/SAXParserBase.java&r1=13273&r2=13274
==============================================================================
--- trunk/src_new/org/argouml/persistence/SAXParserBase.java (original)
+++ trunk/src_new/org/argouml/persistence/SAXParserBase.java 2007-08-09 12:31:25-0700
@@ -108,16 +108,24 @@
/**
* @return the parsing time
*/
- public long getParseTime() { return parseTime; }
+ public long getParseTime() {
+ return parseTime;
+ }
- ////////////////////////////////////////////////////////////////
- // main parsing method
/**
- * @param is the inputstream of the project to read
+ * @param reader the reader to read
* @throws SAXException when parsing xml
*/
- public void parse(Reader is) throws SAXException {
+ public void parse(Reader reader) throws SAXException {
+ parse(new InputSource(reader));
+ }
+
+ /**
+ * @param is the InputSource to read
+ * @throws SAXException when parsing xml
+ */
+ public void parse(InputSource input) throws SAXException {
long start, end;
@@ -127,8 +135,12 @@
try {
SAXParser parser = factory.newSAXParser();
- InputSource input = new InputSource(is);
- input.setSystemId(getJarResource("org.argouml.kernel.Project"));
+
+ // If we weren't given a system ID, attempt to use the URL for the
+ // JAR that we were loaded from. (Why? - tfm)
+ if (input.getSystemId() == null) {
+ input.setSystemId(getJarResource("org.argouml.kernel.Project"));
+ }
start = System.currentTimeMillis();
parser.parse(input, this);