[xmlc] Re: Re: Windows file url problem
Yousif Seedham <[email protected]> Wed, 02 Dec 2009 17:37:34 -0600
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format... ------------=_1259797064-8018-2637 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jacob, Thanks for the reply. I am using version 2.3.1 ( which i think is the latest..) from MANIFEST.MF: Built-On: July 23 2008 Main-Class: org.enhydra.xml.xmlc.commands.xmlc.XMLC Name: org/enhydra/xml/xmlc/ Specification-Title: Enhydra XMLC Specification-Version: 2.3.1 Implementation-Version: 2.3.1 To avoid dealing with the slashes I moved the Body_bottom.html to the same directory as the html page with the include tag. (Note: This is not using xmlcReparseResourceDirs) <!--#include file="Bottom_body.html" --> and I get the same stacktrace. Yousif Jacob Kjome wrote: > What version of XMLC are you using? > > What it's trying to do is generate a URL. There was a bug some time > ago where URL.toExternalForm() was creating URLs that were invalid. > The fix, oddly, was to use URL.toString(). Note that the following is > the correct format for a file URL on Windows... > > file:/C:/Tomcat6.0/webapps/test-project/WEB-INF/classes/view/include/Body_bottom.html > > OR > file:///C:/Tomcat6.0/webapps/test-project/WEB-INF/classes/view/include/Body_bottom.html > > > Backslashes are definitely invalid in a URL. Note that the path > FileInputStream spits out in a FileNotFoundException is somewhat > deceiving because it doesn't know that that path is supposed to > represent a URL. It just spits out slashes matching the System > default. So take it with a grain of salt. The real issue probably > has to do with appending two parts of the file path together; both > including slashes. It probably ends up looking like this internally > to the File object.... > > "C:\Tomcat6.0\webapps\test-project\WEB-INF\classes\view\" + > "include/Body_bottom.html" > > Notice how the first part has all backslashes and the second part has > a forward slash. Don't get me wrong. The way you are coding your > "include" statement is correct. It's a failure on XMLC's (or the > JVM's) part to paste the base path together with the include path. > > It's possible you are using a version of XMLC that doesn't yet have > the fix. Otherwise, if you are using an up-to-date version, then I > can try to reproduce the issue and see what can be done. A possible > workaround might be to add the "include" directory as one of the > configured "xmlcReparseResourceDirs" (see [1] for an example of > configuring this as a context-param) and then just use... > > <!--#include file="Body_bottom.html" --> > > > That said, it looks like you are loading templates from the classpath, > not via resource directories so that solution might not be > applicable In any case, let me know if that helps. Otherwise, I'll > try to reproduce this when I get home from work. > > > [1] > http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xmlc/trunk/xmlc/examples/tomcat/res/webapps/xmlc/WEB-INF/web.xml.in?rev=1591&view=auto > > > Jake > > On Wed, 02 Dec 2009 13:14:23 -0600 > Yousif Seedham <[email protected]> wrote: >> hello, >> >> I am using deferred parsing and I am running into a problem with >> include statements in my html document. >> >> >> html code: >> <!--#include file="include/Body_bottom.html" --> >> >> this works fine on linux(tomcat6, jdk1.6) >> but on windows(tomcat6, jdk1.6) I get the following exception: >> >> org.enhydra.xml.xmlc.XMLCRuntimeException: >> file:\C:\Tomcat6.0\webapps\test-project\WEB-INF\classes\view\include\Body_bottom.html >> (The filename, directory name, or volume label syntax is incorrect) >> >> org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.parseDocument(DocumentLoaderImpl.java:590) >> >> >> org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.checkCacheEntry(DocumentLoaderImpl.java:210) >> >> >> org.enhydra.xml.xmlc.deferredparsing.DocumentLoaderImpl.getDocument(DocumentLoaderImpl.java:238) >> >> view.LoginHTML.buildDocument(LoginHTML.java:211) >> view.LoginHTML.<init>(LoginHTML.java:194) >> view.LoginHTML.<init>(LoginHTML.java:204) >> . >> . >> . >> >> java.io.FileNotFoundException: >> file:\C:\Tomcat6.0\webapps\test-project\WEB-INF\classes\view\include\Body_bottom.html >> (The filename, directory name, or volume label syntax is incorrect) >> java.io.FileInputStream.open(Native Method) >> java.io.FileInputStream.<init>(Unknown Source) >> java.io.FileInputStream.<init>(Unknown Source) >> >> org.enhydra.xml.io.InputSourceOps.openSystemId(InputSourceOps.java:76) >> org.enhydra.xml.io.InputSourceOps.open(InputSourceOps.java:94) >> >> org.enhydra.xml.xmlc.misc.SSIParsedStream.readIntoBuffer(SSIParsedStream.java:198) >> >> . >> . >> . >> >> >> To get it to work on windows I had to define an absolute path: >> <!--#include >> file="/c://Tomcat6.0/webapps/test-project/WEB-INF/classes/view/include/Body_bottom.html" >> --> >> >> It seems to me that windows does not like the >> "file:" in >> "file:\C:\Tomcat6.0\webapps\test-project\WEB-INF\classes\view\include\Body_bottom.html" >> >> which results if i use a relative path in my include. >> >> Any advice would be helpful... >> >> >> Yousif >> >> > ------------=_1259797064-8018-2637 Content-Type: text/plain; charset="UTF-8"; name="message-footer.txt" Content-Disposition: inline; filename="message-footer.txt" Content-Transfer-Encoding: quoted-printable -- You receive this message as a subscriber of the [email protected] mailing list= . To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=3Dhelp OW2 mailing lists service home page: http://www.ow2.org/wws ------------=_1259797064-8018-2637--