You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jose Manuel Valladares Pernas <jm...@miraiespana.com> on 2007/06/13 18:08:50 UTC

Behavior of include/import to avoid regenerate classes

Hello,
I would like to know if it is correct the different behavior of the import and 
include elements regarding the generation of java classes.

Let me explain.

We have two schema files: A.xsd and B.xsd.
Both in namespace http://www.namespace.com.

(Scenario 1)
In A.xsd we use:
<xs:import schemaLocation="B.xsd" namespace="http://www.namespace.com" />

Then we do:
    scomp of B.xsd,
    Create the classes of B.xsd

    scomp of A.xsd using the classes of B.xsd in the classpath

What we get is that the second scomp only produces the classes of A.xsd, 
skipping the ones of B.xsd, because they were already generated.


(Scenario 2)
In A.xsd we use:
<xs:include schemaLocation="B.xsd" />

Then we do:
    scomp of B.xsd,
    Create the classes of B.xsd

    scomp of A.xsd using the classes of B.xsd in the classpath

What we get is that the second scomp produces the classes of A.xsd, and also 
the ones of B.xsd, even when we have these classes already in the classpath.


So we would like to know if this behavior is correct.
In some schema files provided to us the builders decided to use include and 
now we are getting the same classes regenerated several times.
To avoid that we changed the include for imports and everything is working 
fine, but we want to know the reason of this difference.

Thank you very much for your help and your time.

Best regards,
             Jose Manuel Valladares

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


RE: Behavior of include/import to avoid regenerate classes

Posted by Radu Preotiuc-Pietro <ra...@bea.com>.
It's difficult to assess the "correctness", because in the XMLSchema
spec, the semantics of Schema composition are left to the implementors.

What I can say is that what you noticed is "by design". We took the view
that "import" means "reference the given Schema doc", while "include"
means "treat the given Schema doc as if it were part of the current
Schema doc". This makes sense if you think about the case of chameleon
includes where the same Schema doc can produce different Schema
components depending on where it is included from. We tried to keep it
simple and correct.

Radu

> -----Original Message-----
> From: Jose Manuel Valladares Pernas [mailto:jmanuel@miraiespana.com] 
> Sent: Wednesday, June 13, 2007 9:09 AM
> To: user@xmlbeans.apache.org
> Subject: Behavior of include/import to avoid regenerate classes
> 
> Hello,
> I would like to know if it is correct the different behavior 
> of the import and include elements regarding the generation 
> of java classes.
> 
> Let me explain.
> 
> We have two schema files: A.xsd and B.xsd.
> Both in namespace http://www.namespace.com.
> 
> (Scenario 1)
> In A.xsd we use:
> <xs:import schemaLocation="B.xsd" 
> namespace="http://www.namespace.com" />
> 
> Then we do:
>     scomp of B.xsd,
>     Create the classes of B.xsd
> 
>     scomp of A.xsd using the classes of B.xsd in the classpath
> 
> What we get is that the second scomp only produces the 
> classes of A.xsd, skipping the ones of B.xsd, because they 
> were already generated.
> 
> 
> (Scenario 2)
> In A.xsd we use:
> <xs:include schemaLocation="B.xsd" />
> 
> Then we do:
>     scomp of B.xsd,
>     Create the classes of B.xsd
> 
>     scomp of A.xsd using the classes of B.xsd in the classpath
> 
> What we get is that the second scomp produces the classes of 
> A.xsd, and also 
> the ones of B.xsd, even when we have these classes already in 
> the classpath.
> 
> 
> So we would like to know if this behavior is correct.
> In some schema files provided to us the builders decided to 
> use include and 
> now we are getting the same classes regenerated several times.
> To avoid that we changed the include for imports and 
> everything is working 
> fine, but we want to know the reason of this difference.
> 
> Thank you very much for your help and your time.
> 
> Best regards,
>              Jose Manuel Valladares
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org