There are a number of ways to do it, but essentially, you have to define each element as a direct child of the <schema> element. Here's one example:

<schema targetName="http://www.foo.com";
        xmlns:tns="http://www.foo.com"/>
        <element name="foo">
            <complexType>
                  <sequence>
                          <element ref="tns:bar" />
                          <element ref="tns:baz" />
                  </sequence>
            <complexType>
       </element>
       <element name="bar" type="xsd:string"/>
       <element name="baz" type="xsd:string"/>
 </schema>


At 04:12 PM 9/2/2003 +0100, you wrote:
Just for completness, what schema would make the
following xml valid:

<tns:foo xmlns:tns="http://www.foo.com";>
          <tns:bar>cory</tns:bar>
          <tns:baz>anne</tns:baz>
</tns:foo>

Thanks,
Krzysztof

 --- Cory Wilkerson <[EMAIL PROTECTED]> wrote:
> Anne,
>
> So, given the following schema:
>
> <schema targetName="http://www.foo.com"/>
>        <element name="foo">
>            <complexType>
>                  <sequence>
>                          <element name="bar"
> type="xsd:string"/>
>                          <element name="baz"
> type="xsd:string"/>
>                  </sequence>
>            <complexType>
>       </element>
> </schema>
>
>
> You would recommend that implementations produce the
> following realization of a schema instance:
>
> <tns:foo xmlns:tns="http://www.foo.com";>
>          <bar>cory</bar>
>          <baz>anne</baz>
> </tns:foo>
>
> I think most of the community considers your word
> the gospel, I hope they take notice of this exchange
> :)
>
> Thanks,
> Cory
>
>
> -----Original Message-----
> From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 02, 2003 9:52 AM
> To: [EMAIL PROTECTED]
> Subject: RE: xmlns=" " in the doc\literal SOAP
> message
>
>
> Cory,
>
> Yes -- you are right -- bar and baz are local
> elements. What that means is
> that their element names are of type NCname
> (non-colon name) rather than
> QName (qualified name).
>
> Although most systems will accept:
>
> <foo xmlns="http://www.foo.com";>
>          <bar>cory</bar>
>          <baz>anne</baz>
> </foo>
>
> it isn't accurate, because it implies that bar and
> baz are namespace qualified.
>
> The proper way to represent the document would be:
>
> <tns:foo xmlns:tns="http://www.foo.com";>
>          <bar>cory</bar>
>          <baz>anne</baz>
> </tns:foo>
>
> or this:
>
> <foo xmlns="http://www.foo.com";>
>          <bar xmlns="">cory</bar>
>          <baz xmlns="">anne</baz>
> </foo>
>
> It would be wrong to produce a document like this:
>
> <tns:foo xmlns:tns="http://www.foo.com";>
>          <tns:bar>cory</bar>
>          <tns:baz>anne</baz>
> </tns:foo>
>
>
> Also note that your schema definition was
> incomplete. It should look like this:
>
> <schema targetName="http://www.foo.com"/>
>        <element name="foo"
>            <complexType>
>                  <sequence>
>                          <element name="bar"
> type="xsd:string"/>
>                          <element name="baz"
> type="xsd:string"/>
>                  </sequence>
>            <complexType>
>       </element>
> </schema>
>
> or like this
>
> <schema targetName="http://www.foo.com";
>                 xmlns:tns="http://www.foo.com"/>>
>          <complexType name="foo>
>                  <sequence>
>                          <element name="bar"
> type="xsd:string"/>
>                          <element name="baz"
> type="xsd:string"/>
>                  </sequence>
>          <complexType>
>            <element name="foo" type="tns:foo"/>
> </schema>
>
> (there are three or four other ways to describe it
> -- but the point is that
> you must define the element named "foo")
>
> Anne
>
> At 09:02 AM 9/2/2003 -0500, you wrote:
> >Anne,
> >
> >When you say "local" elements -- do you mean local
> to the parent element
> >as defined in the schema?  In the following
> example, would bar and baz be
> >considered local elements?
> >
> ><schema targetName="http://www.foo.com"/>
> >         <complexType name="foo>
> >                 <sequence>
> >                         <element name="bar"
> type="xsd:string"/>
> >                         <element name="baz"
> type="xsd:string"/>
> >                 </sequence>
> >         <complexType>
> ></schema>
> >
> >I would think when this was serialized to the wire
> you'd see something like:
> >
> ><foo xmlns="http://www.foo.com";>
> >         <bar>cory</bar>
> >         <baz>anne</baz>
> ></foo>
> >
> >After all, don't bar and baz technically belong to
> the foo.com namespace?
> >
> >Thanks for any input,
> >Cory WIlkerson
> >
> >
> >-----Original Message-----
> >From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
> >Sent: Tuesday, September 02, 2003 8:40 AM
> >To: [EMAIL PROTECTED]
> >Subject: Re: xmlns=" " in the doc\literal SOAP
> message
> >
> >
> >Dimuthu,
> >
> >Yes. It's okay for empty namespace definitions to
> go across the wire. In
> >fact, it some cases it might be required.
> >
> >In your SOAP request, the <query> element defines a
> default namespace
> >(xmlns="blah" as opposed to xmlns:foo="blah"),
> which then applies to all
> >subelements of the <query> element, unless it is
> overridden by another
> >default namespace definition. If the <description>
> and <ItemId> elements
> >are local elements to <query>, then they should not
> be namespace qualified,
> >and in that case, you should specify an empty
> default namspace definition
> >in each of these subelements to override the active
> default namespace.
> >
> >Now, if the <description> and <ItemId> are global
> elements, then this
> >message would be in error.
> >
> >So whether or not this message is correct depends
> on the schema definition
> >for the message.
> >
> >Anne
> >
> >At 02:20 AM 9/1/2003 -0700, you wrote:
> > >Hi all,
> > >
> > >I'm trying to write a doc\literal web service and
> my soap message appears
> > >as below.........
> > >
> > ><query xmlns="urn:HistorySriLanka">
> > >    <description xmlns="">Wood carving of an
> Elephant</description>
> > >    <ItemId xmlns="">ER234</ItemId>
> > ></query>
> > >
> > >Has anybody else has come across a situation like
> this? Is it ok for empty
> > >xmlns="" tags to go in the wire? Any help is
> greatly appreciated.
> > >
> > >Thank you,
> > >Dimuthu
> > >
> > >
> > >Do you Yahoo!?
> >
>
><http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com>Yahoo!
> > >SiteBuilder - Free, easy-to-use web site design
> software
>
>




Reply via email to