[rules-users] Failed to read schema document when trying to transform from XML to DRL

miguel machado mls.machado at gmail.com
Mon Apr 19 04:47:49 EDT 2010


I'm having this problem as well. I can live with the System.err messages,
but i could use the XSD for configuration validation. Is there a way of
obtaining this "file"?

thanks in advance,
_ miguel


2010/4/13 Chang Liu <CLiu at deltadentalmi.com>

>  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/html/ch04.html#d0e5750
>
>
>
> 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. L
>
>
>
> 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
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
"To understand what is recursion you must first understand recursion"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100419/41b51ddc/attachment.html 


More information about the rules-users mailing list