[rules-users] XML to DRL

T-Otte t-otte at gmx.de
Tue Jan 11 16:21:57 EST 2011


Hello,

I know that this error has come up a few times in the past, but i wasn't
able to solve my problem.
I am trying to convert documents from the drools xml format to .drl using
drools 5.1.

The error i am getting is:
(null: 5, 76): 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>.
(null: 5, 76): cvc-elt.1: Cannot find the declaration of element 'package'.
(null: 6, 35): 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>.
...

Multiple of the example xml documents have been tried, but the error is
always the same. I tried to eliminate uneccessary whitespaces since that was
suggested in one of the previous topics about this issue, but so far to no
avail.

Right now i am using the very simple test_ParseGlobal:
<?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="java.util.HashMap"/>
<import name="org.drools.*"/>
<global identifier="x" type="com.sample.X"/>
<global identifier="yada" type="com.sample.Yada"/>
</package>


My code to do the transformation is:
		PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
		XmlPackageReader reader = new XmlPackageReader(conf.getSemanticModules());
		DrlDumper dumper = new DrlDumper();
		FileReader filereader = new FileReader("test_ParseGlobal.xml");
		PackageDescr descr = reader.read(filereader);
		String test = dumper.dump(descr);
		System.out.println(test);
		FileWriter writer = new FileWriter(new File("test_ParseGlobal.drl"));
		writer.write(dumper.dump(descr));
		writer.flush();
		writer.close();

Thank you for your help!
Best regards
Tobias

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/XML-to-DRL-tp2236936p2236936.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list