Jeff Hooker wrote:
> 
> Another question: how do it determine the full path to an add-on? I know the 
> path to the configuration file within the add-on that I want to load, but I 
> need 
> the full path (i.e. from the file system root right to the base directory of 
> the 
> add-on itself). Where is this available in the XMLmind API?
> 

[A] If your add-on contains a configuration file, add to it something
like this:

<property name="my.base" url="true">do_not_care</property>

See http://www.xmlmind.com/xmleditor/_distrib/doc/configure/property.html

Then execute:

URL base = new URL(System.getProperty("my.base"));
URL url = new URL(base, "myDirectory/myFile.foo");
File file = new File(url.toURI());



OR [B] If your add-on contains an XML catalog, add to it something like:

<rewriteURI uriStartString="my-base:" rewritePrefix="." />

Then execute:

import com.xmlmind.xml.resolve.XMLCatalogs;

URL url = XMLCatalogs.resolveURI("my-base:myDirectory/myFile.foo", null);
File file = new File(url.toURI());

See
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xml/resolve/XMLCatalogs.html#resolveURI(java.lang.String,%20java.net.URL)



OTHERWISE [C] Add an empty XML catalog to your add-on and proceed as in [B].



---
PS: In all cases, you'll be able to get the URL of
"myDirectory/myFile.foo". However whether you'll be able to convert this
URL to a File or not depends on how XXE is being deployed. In the case
of a deployment as an applet or using Java Web Start, the URL will not
be a "file:" URL.




 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to