Ted-

        First, thanks so much for the response.  You have saved my (and my
editor's ;-) ) day.  I seehow they have somewhat changed in regards to
this.  Let me see if I understand this correctly, and thanks for your
response again:

My XML doc:

<?xml version="1.0"?>

<New:Doc xmlns="mySchema.xsd">
  <New:Element1>
    <New:Element2 />
  </New:Element1>
  <Element3 />
</New:Doc>

and then my schema:

<schema targetNamespace="http://myUrl.com";
        xmlns="http://www.w3.org/1999/XMLSchema";
        xmlns:New="http://myUrl.com";>

  <element name="New:Element1" type="New:myElementType" />

  <type name="myElementType">
    <element name="New:Element2 type="string" minOccurs="0" />
  </type>

  <element name="Element3" type="string" />

</schema>


I understand the use of the targetNamespace in the Schema, as
myElementType is not part of the XML Schema defined namespace, but part
of the target one.  That makes sense to me.  I also get the two
namespace (xmlns) attributes of the schema element.  What I am not sure
of is if my original XML document needs to define both namespaces, and
how it would do that; as well as if it needs to prefix all elements with
the "New" namespace.  Lots has changed, that's for sure (my first draft
of the schema bit 3 weeks ago had archetype all over the place ;-) )

Thanks for you help on this...

-Brett

[EMAIL PROTECTED] wrote:
> 
> Brett,
> 
> This has changed in the 12/17 working draft.  See 4 of the draft.
> 
> Ted
> ----- Original Message -----
> From: Brett McLaughlin <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, December 30, 1999 8:45 PM
> Subject: Schemas and Namespaces
> 
> > Question on Schema within XML:
> >
> > So I understand I can have a document like so:
> >
> > <?xml version="1.0"?>
> >
> > <JavaXML:Doc xmlns:JavaXML="http://www.javaxml.com";>
> >   <JavaXML:element1>
> >     <JavaXML:element2 />
> >   </JavaXML:element1>
> > </JavaXML:Book>
> >
> > so I declare my namespace as JavaXML.
> >
> > Then I see how I can have my schema defined as so:
> >
> > <Doc xmlns="docSchema.xsd">
> >   <element1>
> >     <element2 />
> >   </element1>
> > </Doc>
> >
> > But what I am confused on is how to do both?  Would this be correct?
> >
> > <?xml version="1.0"?>
> >
> > <JavaXML:Doc xmlns:JavaXML="http://www.javaxml.com";
> >              xmlns="docSchema.xsd">
> >   <JavaXML:element1>
> >     <JavaXML:element2 />
> >   </JavaXML:element1>
> > </JavaXML:Doc>
> >
> > It seems this wouldn't be right, though as the schema is being applied
> > to the default namespace, which is never actually referenced, since all
> > elements are in the JavaXML namespace.  So does schema validation
> > occur?  Help is appreciated.
> >
> > Thanks,
> > Brett
> >

Reply via email to