Hi there,
Error message:
(null: 5, 77): schema_reference.4: Failed to read schema document
'drools.org/drools-5.0.xsd', because 1) could not find the document; 2) the
document could not be read; 3) the root element of the document is not
<xsd:schema>.
I ran into this issue when experimenting a project that transforming the rules back and
forth from DRL to XML with utility classes as documented in following link:
http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/ht...
My code:
...
XmlPackageReader xmlReader = new XmlPackageReader(null);
StringReader sr = new StringReader(rulesInXml);
try {
PackageDescr packageDescr = xmlReader.read(sr);
DrlDumper drlDumper = new DrlDumper();
String drlString = drlDumper.dump(packageDescr);
}
catch (Exception ex) {
System.out.println(ex);
}
...
where string "rulesInXml" is the result xml string transformed from a valid .drl
file. It looks like:
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0
drools.org/drools-5.0.xsd">
<import name="com.sample.DroolsTest.Message" />
<rule name="Hello World">
<lhs><pattern identifier="m" object-type="Message" >
<field-constraint field-name="status">
<qualified-identifier-restriction evaluator="==">Message.HELLO
</qualified-identifier-restriction>
</field-constraint>
<field-binding field-name="message" identifier="myMessage" />
</pattern>
</lhs>
<rhs> System.out.println( myMessage );
m.setMessage( "Goodbye cruel world" );
m.setStatus( Message.GOODBYE );
update( m );
</rhs>
</rule>
<rule name="GoodBye">
<lhs><pattern object-type="Message" >
<field-constraint field-name="status">
<qualified-identifier-restriction evaluator="==">Message.GOODBYE
</qualified-identifier-restriction>
</field-constraint>
<field-binding field-name="message" identifier="myMessage" />
</pattern>
</lhs>
<rhs> System.out.println( myMessage );
</rhs>
</rule>
</package>
What did I miss here?
Moreover, the Drools 5.0 API's for XML support are poorly-documented. For example, the
constructors of class "XmlPackageReader" has an arg of
"SemanticModules" type which is not documented. :(
Any help would be highly appreciated!
Thanks,
Chang
**********************************************************************
CONFIDENTIALITY NOTICE: The information contained in this email is intended only for the
person or entity to which it is addressed and may contain confidential and/or privileged
material. If you are not the intended recipient, you are hereby notified that any
unauthorized review, use, dissemination, distribution or copying of this communication is
prohibited and may be subject to legal restriction or sanction. If you have received this
email in error, please notify the sender immediately to arrange for return or destruction
of the information and all copies. If you are the intended recipient but do not wish to
receive communications through this medium, please advise the sender immediately. Thank
you