Author: rgardler
Date: Sun Dec 3 19:07:23 2006
New Revision: 482021
URL: http://svn.apache.org/viewvc?view=rev&rev=482021
Log:
- test if we have the type before reading more content, otherwise we read too
much content and end up dumping it
- add XDoc 2.0 as a document type (see Issue tracker regarding the stupidity of
having this hard coded in here)
Modified:
forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java
Modified:
forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java?view=diff&rev=482021&r1=482020&r2=482021
==============================================================================
---
forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java
(original)
+++
forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java
Sun Dec 3 19:07:23 2006
@@ -67,7 +67,7 @@
char[] buf = new char[1000];
int numRead = 0;
String type = null;
- while ((numRead = reader.read(buf)) != -1 && type == null) {
+ while (type == null && (numRead = reader.read(buf)) != -1) {
final String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
buf = new char[1024];
@@ -111,6 +111,8 @@
type = "org.w3c.xhtml2";
} else if
(content.contains("http://forrest.apache.org/helloWorld.dtd")) {
type = "org.apache.forrest.hellowWorld";
+ } else if
(content.contains("http://forrest.apache.org/dtd/document-v20.dtd")) {
+ type = "org.apache.forrest.xdoc2";
}
return type;
}