diff --git a/build/classes/fr/devinsy/xid/FilePresenter.class b/build/classes/fr/devinsy/xid/FilePresenter.class index ee698d8..c8c2d21 100644 Binary files a/build/classes/fr/devinsy/xid/FilePresenter.class and b/build/classes/fr/devinsy/xid/FilePresenter.class differ diff --git a/build/classes/fr/devinsy/xid/StringPresenter.class b/build/classes/fr/devinsy/xid/StringPresenter.class index 8dd411f..ec785cd 100644 Binary files a/build/classes/fr/devinsy/xid/StringPresenter.class and b/build/classes/fr/devinsy/xid/StringPresenter.class differ diff --git a/src/fr/devinsy/xid/FilePresenter.java b/src/fr/devinsy/xid/FilePresenter.java index d748307..f801c4d 100644 --- a/src/fr/devinsy/xid/FilePresenter.java +++ b/src/fr/devinsy/xid/FilePresenter.java @@ -1,7 +1,7 @@ package fr.devinsy.xid; import java.io.*; -import org.w3c.dom.*; + /** @@ -17,6 +17,7 @@ public class FilePresenter extends DomPresenter protected String sourceFilePathname; protected long sourceFileTime; + protected String doctype; /* * @@ -26,6 +27,7 @@ public class FilePresenter extends DomPresenter this.sourceFilePathname = null; this.sourceFileTime = 0; this.doc = null; + this.doctype = ""; } @@ -37,6 +39,7 @@ public class FilePresenter extends DomPresenter this.sourceFilePathname = filePathname; this.sourceFileTime = 0; this.doc = null; + this.doctype = ""; } @@ -48,6 +51,7 @@ public class FilePresenter extends DomPresenter this.sourceFilePathname = filePathname; this.sourceFileTime = 0; this.doc = null; + this.doctype = ""; } @@ -81,10 +85,10 @@ public class FilePresenter extends DomPresenter { StringBuffer result; - String sourceFilePath = this.sourceFilePathname; - + logger.info("doXid for file [" + this.sourceFilePathname + "]"); + // Get the good tree. - File source = new File (sourceFilePath); + File source = new File (this.sourceFilePathname); if (source == null) { @@ -95,17 +99,17 @@ public class FilePresenter extends DomPresenter } else if (!source.exists ()) { - String errorMessage = "source file defined but not found (" + sourceFilePath + ")"; + String errorMessage = "source file defined but not found (" + this.sourceFilePathname + ")"; logger.error (errorMessage); result = null; throw new Exception (errorMessage); } else if ((this.doc == null) || - (this.sourceFileTime != source.lastModified ())) + (this.sourceFileTime != source.lastModified ())) { this.sourceFileTime = source.lastModified (); - this.doc = Presenter.fileToTree (sourceFilePath); - + this.doc = Presenter.fileToTree (this.sourceFilePathname); + this.doctype = getDoctype(this.sourceFilePathname); if (this.doc != null) { Presenter.addMetaTag (doc, "generator", "XID 0.0"); @@ -114,6 +118,9 @@ public class FilePresenter extends DomPresenter // Build the web page. StringWriter htmlCode = new StringWriter(Presenter.estimatedTargetLength(source.length())); + htmlCode.write(doctype); + htmlCode.write('\n'); + Presenter.doXid (htmlCode, doc, datas); result = htmlCode.getBuffer(); @@ -122,6 +129,33 @@ public class FilePresenter extends DomPresenter } + static public String getDoctype (String filePathname) throws Exception + { + String result; + + // + BufferedReader in = new BufferedReader (new FileReader (filePathname)); + String doctype = in.readLine(); + in.close(); + + logger.info("doctype=[" + doctype + "]"); + + // + if ((doctype.startsWith ("'))); + } Presenter.doXid (htmlCode, doc, datas); StringBuffer htmlTarget = htmlCode.getBuffer();