morgand 01/09/06 08:40:24
Modified: latka/src/java/org/apache/commons/latka/xml
XMLPreprocessor.java
Log:
fixed problem with an exhausted stream
Revision Changes Path
1.11 +6 -2
jakarta-commons/latka/src/java/org/apache/commons/latka/xml/XMLPreprocessor.java
Index: XMLPreprocessor.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/xml/XMLPreprocessor.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XMLPreprocessor.java 2001/09/06 15:19:25 1.10
+++ XMLPreprocessor.java 2001/09/06 15:40:24 1.11
@@ -154,14 +154,18 @@
public Set findVariables(Reader reader)
throws IOException {
+ // since we don't know if this stream will support reset(),
+ // pull the suite into a string
+ String xml = stringFromReader(reader).trim();
+
// accumulate the sets from the Reader and all
// external entities here
- Set set = getLocalVariables(reader);
+ Set set = getLocalVariables(new StringReader(xml));
// now that we have variables from the initial URI,
// perform a SAX parse to find additional variables
// in external entities
- InputSource source = new InputSource(reader);
+ InputSource source = new InputSource(new StringReader(xml));
set.addAll(getVariablesFromEntites(source));
return set;