Re: JESS: Problem when loading Rule as a String

"Wolfgang Laun" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <14492_1280335757_o6SGnHQ4015425_AANLkTikJMYYsxt44bYjJau4QzPqkVQPpOPmOpvK0Sy-u@mail.gmail.com>
If the String s contains XML, you should use a JessSAXParser. Jesp
parses only .clp.
-W

On 28 July 2010 15:46, Pierre de Leusse <[email protected]> wrote:
> Hello all,
>
>
>
> I receive a Jess rule through the network in XML format and when I try to
> load it in the Rete engine, it throws an error. I know the rule itself is
> valid.
>
>
>
> Am I doing something wrong?
>
>
>
> Thanks for the help and tips,
>
> Pierre
>
>
>
> Code:
>
> for (String s : rules){
>
> try {
>
>             StringReader read = new StringReader(s);
>
>             Jesp parser = new Jesp(read, Demo.engine.getEngine());
>
>             parser.parse(false);
>
>       } catch (JessException e) {
>
>             e.printStackTrace();
>
>       }
>
> }
>
>
>
> Error:
>
> Jess reported an error in routine Jesp.parseExpression.
>
>   Message: Expected a '(', constant, or global variable at token '&'.
>
>   Program text: &  at line 22 in file <unknown>.
>
>       at jess.Jesp.error(Unknown Source)
>
>       at jess.Jesp.parseExpression(Unknown Source)
>
>       at jess.Jesp.promptAndParseOneExpression(Unknown Source)
>
>       at jess.Jesp.parse(Unknown Source)
>
>       at jess.Jesp.parse(Unknown Source)
>
>       at
> agh.edu.pl.soa.yield.jess.middleware.Functional.putRules(Functional.java:100)
>
>       at
> agh.edu.pl.soa.yield.jess.middleware.test.FunctionalTest.testPutRules(FunctionalTest.java:59)
>
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>       at java.lang.reflect.Method.invoke(Method.java:597)
>
>       at junit.framework.TestCase.runTest(TestCase.java:154)
>
>       at junit.framework.TestCase.runBare(TestCase.java:127)
>
>       at junit.framework.TestResult$1.protect(TestResult.java:106)
>
>       at junit.framework.TestResult.runProtected(TestResult.java:124)
>
>       at junit.framework.TestResult.run(TestResult.java:109)
>
>       at junit.framework.TestCase.run(TestCase.java:118)
>
>       at junit.framework.TestSuite.runTest(TestSuite.java:208)
>
>       at junit.framework.TestSuite.run(TestSuite.java:203)
>
>       at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>
>       at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>
>       at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>
>       at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>
>       at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>
>       at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
>
>
>
> Which seems to come from the following line in the XML
>
>             <funcall>
>
>               <name>&gt;</name>




--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.