Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: substitutionGroup across namespaces

From: George Cristian Bina <george@----.-->
To: Mark Proctor <mproctor@--------.--->
Date: 10/25/2004 5:41:00 PM
Hi Mark,

Well, the following schemas plus instance are valid(Xerces 2.6.2). I do 
not know what SCHEMA_SOURCE contains in your code line:

parser.setProperty(SCHEMA_SOURCE,( InputStream[] ) schemaList.toArray( 
new InputStream[0] ) );

You may try setting a value similar with the one from schemaLocation 
attribute to the 
http://apache.org/xml/properties/schema/external-schemaLocation property.

rules.xsd
=========

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://drools.org/rules"
     elementFormDefault="qualified" xmlns:rules="http://drools.org/rules">
     <xs:element name="rule-set">
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" maxOccurs="unbounded" 
ref="rules:rule"/>
             </xs:sequence>
             <xs:attribute name="name" use="required" type="xs:string"/>
             <xs:attribute name="description" type="xs:string"/>
         </xs:complexType>
     </xs:element>
     <xs:element name="rule">
         <xs:complexType>
             <xs:sequence>
                 <xs:element name="parameter" maxOccurs="unbounded">
                     <xs:complexType>
                         <xs:sequence>
                             <xs:element ref="rules:class"/>
                         </xs:sequence>
                         <xs:attribute name="identifier" use="required" 
type="xs:string"/>
                     </xs:complexType>
                 </xs:element>
                 <xs:element ref="rules:condition" maxOccurs="unbounded"/>
                 <xs:element ref="rules:consequence"/>
             </xs:sequence>
             <xs:attribute name="name" use="required" type="xs:string"/>
             <xs:attribute name="salience" type="xs:integer"/>
             <xs:attribute name="no-loop" type="xs:boolean"/>
             <xs:attribute name="description" type="xs:string"/>
         </xs:complexType>
     </xs:element>
     <xs:element name="class" type="xs:string" abstract="true"/>
     <xs:element name="condition" type="xs:string" abstract="true"/>
     <xs:element name="consequence" type="xs:string" abstract="true"/>
</xs:schema>

java.xsd
========

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     targetNamespace="http://drools.org/semantics/java" 
elementFormDefault="qualified"
     xmlns:java="http://drools.org/semantics/java" 
xmlns:rules="http://drools.org/rules">
     <xs:import namespace="http://drools.org/rules" 
schemaLocation="rules.xsd"/>
     <xs:element name="class" type="xs:string" 
substitutionGroup="rules:class"/>
     <xs:element name="condition" type="xs:string" 
substitutionGroup="rules:condition"/>
     <xs:element name="consequence" type="xs:string" 
substitutionGroup="rules:consequence"/>
</xs:schema>

sample.xml
==========

<?xml version="1.0" encoding="UTF-8"?>
<rule-set name="fibonacci" xmlns="http://drools.org/rules"
     xmlns:java="http://drools.org/semantics/java"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://drools.org/semantics/java java.xsd 
http://drools.org/rules rules.xsd">
     <rule name="Recurse" salience="10">
         <parameter identifier="f">
 
<java:class>org.drools.examples.fibonacci.Fibonacci</java:class>
         </parameter>
         <java:condition>f.getValue() == -1</java:condition>
         <java:consequence> System.err.println( "recurse for " + 
f.getSequence() );
             drools.assertObject( new Fibonacci( f.getSequence() - 1 ) 
); </java:consequence>
     </rule>
</rule-set>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com

From mproctor@c... Mon Oct 25 12:10:35 2004
Received: from bart.w3.org ([128.30.52.40])
	by frink.w3.org with esmtp (Exim 4.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent