xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolfgang Winter <wolfgang.win...@ostiasolutions.com>
Subject inst2xsd generating schemas that don't validate
Date Wed, 26 Mar 2014 15:54:59 GMT
Dear list,

we use XmlBeans inst2xsd to create a schema from this simple piece of XML

ns1:Level1 xmlns:ns1="http://schemas.ns1/" xmlns:ns2="http://schemas.ns2/">
     <ns2:Level2>
         <Level3>xyz</Level3>
     </ns2:Level2>
</ns1:Level1>


The output is the following 3 schemas (NS0, NS1 and NS2)

<schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="Level3" type="xs:string"
xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
</schema>

<schema attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://schemas.ns2/"
xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="Level2" type="sch:Level2Type"
xmlns:sch="http://schemas.ns2/"/>
   <complexType name="Level2Type">
     <sequence>
       <element ref="Level3"/>
     </sequence>
   </complexType>
</schema>

<schema attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://schemas.ns1/"
xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="Level1" type="sch:Level1Type"
xmlns:sch="http://schemas.ns1/"/>
   <complexType name="Level1Type">
     <sequence>
       <element ref="sch:Level2" xmlns:sch="http://schemas.ns2/"/>
     </sequence>
   </complexType>
</schema>

Now, NS0, which defines the inner type/element validates fine, but
neither NS1 nor NS2 do, simply because there is no reference (read:
schema import) to the "lower level" schemas.


For example, when using Eclipse's validation function we get the
following for NS2 (which is essentially the message from WS-I
validation)

src-resolve.4.2: Error resolving component 'sch:Level2'. It was
detected that 'sch:Level2' is in namespace 'http://schemas.ns2/', but
components
  from this namespace are not referenceable from schema document
'file:///eclipseWS/runtime/Project/bin/xsds/
  NS2.xsd'. If this is the incorrect namespace, perhaps the prefix of
'sch:Level2' needs to be changed. If this is the correct namespace,
then an
  appropriate 'import' tag should be added to
'file:///eclipseWS/runtime/Project/bin/xsds/NS2.xsd'.


This is one half of the story, the other half is:

We generate a WSDL and import these schemas, but WS-I validation fails
with a BP2122 assertion,
and while most consumers work just fine with that WSDL tools like MS
InfoPath simply refuse to
accept it, so we need a way of getting "valid" schemas generated,
which would mean having the
respective imports added as required.

It doesn't look like there are any options to influence inst2xsd
generation in that area,
have I missed something ?

Any suggestions for getting around this ?


Thanks in advance & best regards

Wolfgang

Mime
View raw message