RE: <xsd:any> misunderstandings? RESOLVED!!!

Hello once more,

I think both Priscilla and Jeni are getting at the same point...that the
parser needs some way to explicitly validate the contents of the
<xsd:any>-specified sub-document.

When I applied both of these suggestions (jeni's in the WSDL-schema
document and priscilla's in the instance document) the problem was
solved!  Thank you both so much!

However, I don't think I understand the rationale behind the
solution...I mean, the wsdl-schema document was aware of the
http://www.w3.org/2001/XMLSchema namespace (heck, the WSDL-schema
document uses it as the default namespace...it's a SCHEMA document!)
Why couldn't it just apply whatever method it was using to validate all
the other schemas to the instance document as well?  Here's a clearer
formulation of my question:


WSDL-Schema looks like:

<schema  xmlns="http://www.w3.org/2001/XMLSchema"
         targetNamespace="http://schemas.xmlsoap.org/wsdl/"
	... >
  <element name="types" type="typesType">
  <complexType name="typesType">
    <complexContent>
      <extension base="wsdl:documented">
        <sequence>
          <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  ...
</schema>


My instance document looks like:
<Document  xmlns="http://me.com/myHiLevelNS">
  <myServiceWSDL>
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/">
      <types>
        <!-- I'll put my custom schema-elements here -->
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                    targetNamespace="http://me.com/mySchemaTypesNS"
                    xmlns:tns="http://me.com/mySchemaTypesNS">
           <xsd:complexType name="blahblah">
              ....
           </xsd:complexType>
        </xsd:schema>
      </types>
    </definitions>
  </myServiceWSDL>
</Document>


Now the validation-logic of my parser (Xerces-1.4.3) doesn't seem to
have any problem validating the WSDL schema, and I didn't explicitly
resolve the schema-uri there!  Yet if I write schema like the above I
will always get that error.  I need to explicitly resolve the
"http://www.w3.org/2001/XMLSchema" ns if I want to get proper
validation, (either in the WSDL-schema document with an <xs:import>
element or in the instance document with an xsi:schemaLocation
attribute).

Is this "parser-funkiness" or is this the intention of the spec?

At least the problem is solved!!!  I would never have though to try this
solution if I hadn't got your guys help!  Thanks again.

--saul


On Thu, 2001-11-08 at 11:47, Priscilla Walmsley wrote:
> Hi Saul,
> 
> Are you specifing a schemaLocation in your instance?  It has to know where
> to go look for the declaration for xsd:schema.
> 
> So, it might look like:
> 
> <types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://www.w3.org/2001/XMLSchema
>                            xmlschema.xsd">
> 	<xsd:sch<complexTypeema xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
> </types>
> 
> (if you have a local copy of the schema for schemas at xmlschema.xsd)
> 
> Also, what parser are you using?  Maybe it's a bug.
> 
> 
> Priscilla
> 
> -----------------------------------------------------------
> Priscilla Walmsley                   priscilla@walmsley.com
> Vitria Technology                     http://www.vitria.com
> Author, Definitive XML Schema    (Prentice Hall, Dec. 2001)
> -----------------------------------------------------------
> 
> > -----Original Message-----
> > From: xmlschema-dev-request@w3.org
> > [mailto:xmlschema-dev-request@w3.org]On Behalf Of Saul Farber
> > Sent: Thursday, November 08, 2001 11:23 AM
> > To: xmlschema-dev@w3.org
> > Subject: Re: <xsd:any> misunderstandings?
> >
> >
> > Thanks for your suggestions, guys, but I think I have already
> > taken care
> > of those issues...plus I think I mis-copied my xml to my first post.
> > Sorry!  I'll try to spell out the problem in more detail.
> >
> > WSDL:
> >
> > <types>
> > 	<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
> > </types>
> >
> > WSDL-Schema: (***copied from the OFFICIAL wsdl-schema***)
> > *** the declared namespace here is
> > xmlns="http://www.w3.org/2001/XMLSchema ***
> >
> > <element name="types" type="wsdl:typesType"/>
> > <complexType name="typesType">
> >   <complexContent>
> >     <extension base="wsdl:documented">
> >       <sequence>
> >         <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
> >       </sequence>
> >     </extension>
> >   </complexContent>
> > </complexType>
> >
> > so my <xsd:schema> element is in an "other" namespace (namely the
> > xml-schema ns) and it is valid (it is a validatable element from the
> > http://www.w3.org/2001/XMLSchema namespace).
> >
> > Yet I still get the:
> > Error on line 20 of document /home.../document.xml: Element type
> > "xsd:schema" must be declared.
> > error.  Like I said below, isn't the point of the xsd:all element to
> > allow for arbitrary sub-documents?
> >
> > Argh!
> >
> > any further suggestions?
> >
> > --saul
> >
> > On Wed, 2001-11-07 at 22:02, Eddie Robertsson wrote:
> > > > When defining WSDL types, one uses a bit of XML like the
> > following:
> > > >
> > > > <types>
> > > >         <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema">
> > > >                 ...
> > > >         </xsd:schema>
> > > > </types>
> > >
> > > Try changing the namespace declaration to
> > > 'xmlns:xsd="http://www.w3.org/2001/XMLSchema"'
> > > As it is now you're declaring the default namespace to
> > point to XML Schema but
> > > you still have no definition for the xsd: prefix (unless
> > you have one further
> > > up in the tree structure...)
> > >
> > > Cheers,
> > > /Eddie
> > >
> > > >
> > > >
> > > > The definition of the "types" element in the WSDL-schema
> > (version 1.1)
> > > > is as follows (from http://schemas.xmlsoap.org/wsdl/):
> > > >
> > > > <element name="types" type="wsdl:typesType"/>
> > > > <complexType name="typesType">
> > > >   <complexContent>
> > > >     <extension base="wsdl:documented">
> > > >       <sequence>
> > > >         <any namespace="##other" minOccurs="0"
> > maxOccurs="unbounded"/>
> > > >       </sequence>
> > > >     </extension>
> > > >   </complexContent>
> > > > </complexType>
> > > >
> > > > So I wrote the following xml (to conform to this schema),
> > thinking that
> > > > the <any> element would let me write xml like the above...with the
> > > > correct namespace, etc.
> > > >
> > > > However, when validating, I get the following error
> > > > >> Error on line 20 of document /home.../document.xml:
> > Element type
> > > > "xsd:schema" must be declared.
> > > >
> > > > I thought the whole point of having an <xsd:any> tag was
> > to ELIMINATE
> > > > the need to pre-declare exactly was is to go into the xml!  My
> > > > <xsd:schema> structure is both well-formed and valid, I
> > just can't seem
> > > > to get the <xsd:any> element to "accept" an un-declared child.
> > > >
> > > > I can always fix this by setting the "processContents"
> > attribute of the
> > > > <any> element to "skip", but this defeats what I want to
> > do...which is
> > > > have valid xml-schema in the <types> section of the WSDL.
> > > >
> > > > What am I missing here...is my understanding of exactly
> > what <xsd:any>
> > > > does wrong?>
> > > >
> > > > thanks in advance!
> > > > saul
> > > >
> > > > --
> > > > Syncline, Inc.
> > > > 373 Washington St.
> > > > Boston, MA  02108
> > > >
> > > > 617-986-1000 (x248)
> > > >
> > > > www.syncline.com -- Informing the Enterprise
> > > > www.mapciti.com -- It's Your Town on the Web
> > > >
> > > >
> > --------------------------------------------------------------
> > ----------
> > > >    Part 1.2Type: application/pgp-signature
> > >
> > >
> > --
> > Syncline, Inc.
> > 373 Washington St.
> > Boston, MA  02108
> >
> > 617-986-1000 (x248)
> >
> > www.syncline.com -- Informing the Enterprise
> > www.mapciti.com -- It's Your Town on the Web
> >
> 
> 
-- 
Syncline, Inc.
373 Washington St.
Boston, MA  02108

617-986-1000 (x248)

www.syncline.com -- Informing the Enterprise
www.mapciti.com -- It's Your Town on the Web

Received on Thursday, 8 November 2001 14:25:12 UTC