Hi All,

I get unexpected behaviour when I put grammar rules in more than 1 external 
file (http://wiki.languagetool.org/tips-and-tricks#toc9) AND when one of the 
grammar files contains an external entity.

This grammar.xml (and the related grammar files) do what I expect:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE doc [
<!ENTITY TestHello SYSTEM 
"http://www.techscribe.co.uk/tester/grammar-hello-world.xml";>
<!ENTITY TestBye SYSTEM "../data-files/grammar-goodbye.xml">
]>
<rules lang="en" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xsi:noNamespaceSchemaLocation="https://github.com/languagetool-org/languagetool/blob/master/languagetool-core/src/main/resources/org/languagetool/rules/rules.xsd";>
&TestHello; 
&TestBye;
</rules>

I want to use the external entity TestBye in grammar-hello-world.xml like this:

  <category name="grammar-tester"> 
    <rule id="hello-world" name="hello world" type="style">
[rule definition goes here]
    </rule>
  </category>
&TestBye;

I can use TestBye in grammar-hello-world.xml with this grammar.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE doc [
<!ENTITY TestHello SYSTEM "../data-files/grammar-hello-world.xml">
<!ENTITY TestBye SYSTEM "../data-files/grammar-goodbye.xml">
]>
<rules lang="en" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xsi:noNamespaceSchemaLocation="https://github.com/languagetool-org/languagetool/blob/master/languagetool-core/src/main/resources/org/languagetool/rules/rules.xsd";>
&TestHello;
</rules>

I can use TestBye in grammar-hello-world.xml when grammar.xml has these entity 
definitions:
<!ENTITY TestHello SYSTEM 
"http://www.techscribe.co.uk/tester/grammar-hello-world.xml";>
<!ENTITY TestBye SYSTEM 
"http://www.techscribe.co.uk/tester/grammar-goodbye.xml";>

But, should I be able to use these entity definitions? They cause a testrules 
error and an error when LT starts:
<!ENTITY TestHello SYSTEM 
"http://www.techscribe.co.uk/tester/grammar-hello-world.xml";>
<!ENTITY TestBye SYSTEM "../data-files/grammar-goodbye.xml">

This is the testrules error (in part):
Running XML validation for en/grammar.xml...
Exception in thread "main" java.io.IOException: Cannot load or parse 
'/org/languagetool/rules/en/grammar.xml'
        at 
org.languagetool.XMLValidator.validateWithXmlSchema(XMLValidator.java:130)
        at 
org.languagetool.rules.patterns.PatternRuleTest.validatePatternFile(PatternRuleTest.java:197)
        at 
org.languagetool.rules.patterns.PatternRuleTest.runTestForLanguage(PatternRuleTest.java:149)
        at 
org.languagetool.rules.patterns.PatternRuleTest.runGrammarRulesFromXmlTestIgnoringLanguages(PatternRuleTest.j
ava:144)
        at 
org.languagetool.rules.patterns.PatternRuleTest.main(PatternRuleTest.java:502)
Caused by: java.io.FileNotFoundException: 
http://www.techscribe.co.uk/data-files/grammar-goodbye.xml
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown 
Source)

Regards,

Mike Unwalla


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to