opensubscriber
   Find in this group all groups
 
Unknown more information…

u : user@xmlbeans.apache.org 31 August 2009 • 10:16PM -0400

Provide additional schema to xmlbeans
by Johannes Homuth

REPLY TO AUTHOR
 
REPLY TO GROUP




Hello List,

I've a question how it is possible to provided additional schema to
xmlbeans at runtime. Maybe my explanation is a little poor, that's why a
example.

I have a project which declares an schema. This schema does only provide
some abstract types.

(Shorted version)
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="com/vw/ais/jobengine/configurations"
    xmlns:tns="com/vw/ais/jobengine/configurations"
xmlns:protyp="com/vw/ais/jobengine/propertytypes"
    elementFormDefault="qualified">
    <xsd:import schemaLocation="../propertytypes/xmlPropertyTypes.xsd"
namespace="com/vw/ais/jobengine/propertytypes"/>

    <xsd:element name="Job" abstract="true" type="tns:JobConfig"/>

    <!--Declare which elements a job could have-->
    <xsd:complexType name="JobConfig">
        <xsd:sequence>
            ....
            ....
            <xsd:element name="kldap" type="protyp:kldapProperty"
                         minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="timespan" type="protyp:timespanProperty"
                         minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element name="dependency" type="protyp:dependencyProperty"
                         minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="jobName" type="xsd:string" use="required"/>
    </xsd:complexType>

    <!-- Declare container for variable content -->
    <xsd:element name="JobEngine">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="applicationname" minOccurs="1"
maxOccurs="1">
                    <xsd:complexType>
                        <xsd:complexContent>
                            <xsd:restriction
base="protyp:applicationProperty"/>
                        </xsd:complexContent>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="executionInterval" minOccurs="1"
maxOccurs="1">
                    <xsd:complexType>
                        <xsd:complexContent>
                            <xsd:restriction
base="protyp:periodicalProperty">
                            </xsd:restriction>
                        </xsd:complexContent>
                    </xsd:complexType>
                </xsd:element>
                *<xsd:element ref="tns:Job"  minOccurs="0"
maxOccurs="unbounded"/>*
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>


XMLBeans will compile classes from this schema and use them, no problem.

Now I want to extend (concretize) this schema in another project and
then parse a xml file  which is derived from this schema.

Project A -> defines (abstract) schema A
Project B -> concretize schema A
Project A -> should parse concretized schema

If I will do this the program will abort with the following message.

Expected element 'Job@com/vw/ais/jobengine/configurations' instead of
'ArchiveJob@com/vw/ais/jobengine/configurations' here in element
JobEngine@com/vw/ais/jobengine/configurations

I think the error occurs because the Project A does not know that the
element "ArchiveJob" (which was specified in the concretized schema) is
from type Job
(<xsd:element name="ArchiveJob" substitutionGroup="conf:*Job*"
type="tns:ArchiveJobConfig"/>)

Know my question. Is it possible in some way to provide another schema
to the xmlbeans parser, at runtime.

I hope you will understand my question
Thx for suggestions

--
Johannes Homuth

-----------------------------------
SOURCEPARK GmbH

Johannes Homuth
Helmholtzstr. 2-9 Gebäude M
10587 Berlin  
Tel:    +49 (0)30/398 068 30
Fax:    +49 (0)30/398 068 39
e-mail: jhomuth@sour...
www:    www.sourcepark.de
-----------------------------------
Sitz der Gesellschaft: Berlin
Handelsregister: Amtsgericht Berlin-Charlottenburg, HR B 80254
Ust-IDNr.: DE813218235
Geschäftsführer: Matthias Barmeier, Harald Dürr
-----------------------------------
Diese E-Mail kann vertrauliche und/oder rechtlich geschützte
Informationen enthalten. Wenn Sie nicht der richtige Adressat
sind oder diese E-Mail irrtümlich erhalten haben, informieren
Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser
E-Mail ist nicht gestattet.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlb...
For additional commands, e-mail: user-help@xmlb...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

opensubscriber is not affiliated with the authors of this message nor responsible for its content.