On 11/12/2012 08:47 PM, Wasiq Shaikh wrote:
If so, we will consider upgrading as the spell check functionality is required
for our custom editor.
I don't understand. XXE always had a good spell-checker. Simply v5.4.1 now
gives you the choice between two spell-checker engines: XMLmind Spell Checker
and Hunspell.
Well what we've done is created the editor from scratch, embedding it in our
IDE without any spell checker functionality. In order to activate the
auto-spell checker, it creates a new private spell checker with empty
dictionaries in the dictionary manager. Since I can't see the source or
documentation for the spell checker, I'm having trouble getting this to work.
The error I get is:
AutoSpellChecker cannot be activated for
'file:/C:/work/testdoc/meta/books/aaa.bookmap': cannot create a SpellChecker:
no dictionaries at all?
The exception gets thrown at SpellCheckerFactory::doCreateSpellChecker()
DictionaryManagerItem[] items = spellChecker.listLanguages();
if (items.length == 0)
throw new SpellException("no dictionaries");
Is it possible to specify a dictionary located inside a JAR?
You mean: inside a jar containing files other than dictionary files.
Yes. All supporting XXE files are packaged inside a JAR file. I'm hoping to put
the dictionary file in there as well but I can't see the source to know if this
is actually possible (or modify it).
--> May be your problem is not that difficult to solve. The stock XXE
v4.9.1 does more or less this:
1) Add en.dar to your CLASSPATH. Look inside this .dar (=.jar file). It
contains a text file called "en/default".
2) Declare your dictionary as follows:
---
String dictName = "/en/default";
URL dictURL = YOUR_CLASS_HERE.class.getResource(dictName);
if (dictURL != null) {
SpellCheckerFactory.defineDictionary(dictName, dictURL);
}
---
This is done in src/com/xmlmind/xmleditapp/kit/part/SpellOptionsPart.java
(You should read the source code of SpellOptionsPart.java and of
SpellCheckerFactory.java.)
3) Optionally invoke:
---
SpellCheckerFactory.setPersonalDictionaryPath(YOUR_DIR_HERE +
File.separatorChar + "dict_%L%.txt").
---
This is also done in
src/com/xmlmind/xmleditapp/kit/part/SpellOptionsPart.java
Now, SpellCheckerFactory.doCreateSpellChecker() should not raise an
exception.
If all this work, you may consider removing en.dar from your CLASSPATH
and instead add all its contents to your custom .jar file. Because we
used YOUR_CLASS_HERE.class.getResource(), this should make no difference.
--> What else can we do for you:
* Give you access to the source code of XXE v4.9.1, in case you forgot
to download it.
* Give you access to the user manual and API javadoc of XMLmind Spell
Checker.
If this is not sufficient, then you may consider hiring us. See
http://www.xmlmind.com/xmleditor/customization_service.html
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support