List Info

Thread: Behavior of include/import to avoid regenerate classes




Behavior of include/import to avoid regenerate classes
country flaguser name
Spain
2007-06-13 11:08:50
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.c
om" />

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-unsubscribexmlbeans.apache.org
For additional commands, e-mail: user-helpxmlbeans.apache.org


RE: Behavior of include/import to avoid regenerate classes
user name
2007-06-13 15:41:19
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:jmanuelmiraiespana.com] 
> Sent: Wednesday, June 13, 2007 9:09 AM
> To: userxmlbeans.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.c
om" />
> 
> 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-unsubscribexmlbeans.apache.org
> For additional commands, e-mail: user-helpxmlbeans.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-unsubscribexmlbeans.apache.org
For additional commands, e-mail: user-helpxmlbeans.apache.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )