On 06/21/2012 05:14 PM, Olivier Relot wrote:
>
> i'm using xxe-perso-5_3_0 ; i've worked with xxe-pro-5_3_0-alpha3
> edition to customize my own project : i had a class in java for my own
> command and i could get back the bin directory path of the xxe
> application directly :
> for example, the code
>
> File f = new File("f");
> System.out.println(f.getAbsolutePath());
>
> sent back to me C:/Programmes Files (x86)/xxe-pro-5_3_0-alpha3/bin/f
> but now i get C://f

Please uninstall xxe-pro-5_3_0-alpha3. Having two versions of XXE 
installed on the same machine is likely to cause problems.



>
> i would like to know how i can find in java the bin directory path with
> xxe-perso-5_3_0
>

--> What follows works only for the desktop application. Cannot work 
when XXE is deployed using Java Web Start or an applet.

File appDir = com.xmlmind.xmleditapp.start.Start.appDir();
File binDir = new File(appDir, "bin");

See 
http://www.xmlmind.com/xmleditor/_distrib/doc/api/com/xmlmind/xmleditapp/start/Start.html

Notice that the above API is not documented and as such, not officially 
supported. Please use the above API only when prototyping.



--> The right way to access resources installed by an extension is to 
use an XML catalog. The following example is taken from our MathML 
add-on. This works wherever this add-on has been installed and no matter 
how XXE has been deployed.

mathml_config/mathml_catalog.xml:
---
<?xml version="1.0" ?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
   <rewriteURI uriStartString="mathml-config:" rewritePrefix="." />
   ...
</catalog>
---

Once the above <rewriteURI> rule has been defined, the URL of a resource 
is obtained as follows (example "common/pane/mathml.pane" found in the 
MathML add-on directory):

---
import com.xmlmind.xml.resolve.XMLCatalogs;

/*Notice the "mathml-config:" prefix. */
URL url = 
XMLCatalogs.resolveURI("mathml-config:common/pane/mathml.pane", null);
---

References:

* "XML Entity and URI Resolvers"
http://xerces.apache.org/xml-commons/components/resolver/resolver-article.html

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





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

Reply via email to