XML Schema Question

Brett McLaughlin bmclaugh at algx.net
Sun Jan 2 03:08:56 GMT 2000


All-

	I'm trying to get my head around the latest revision (12-17-99) of the
XML Schema spec, as it changes quite a bit from previous versions.  If
someone could let me know if I'm on track, or what I'm missing, I'd
appreciate it.

My understanding is for XML like this:

<?xml version="1.0"?>

<myNamespace:Doc xmlns="Schema/mySchema.xsd" 
                 xmlns:myNamespace="http://someUrl.com"
>

  <myNamespace:element1>
    <myNamespace:element2 />
  </myNamespace:element1>

  <myNamespace:element3>Some content</myNamespace:element3>

</myNamespace:Doc>

the myNamespace namespace is of course associated with
http://someUrl.com.  And the schema for the document that would be used
for validation would be Schema/mySchema.xsd, as defined in the default
namespace.  Is that correct?  I know that was the previous version...

And in my schema (here's where everything changed):

<?xml version="1.0"?>
<!DOCTYPE schema
    PUBLIC 
      "-//W3C//DTD XML Schema Version 1.0//EN"
    SYSTEM 
      "http://www.w3.org/TR/1999/WD-xmlschema-1-19991217/structures.dtd"
>

<schema targetNamespace="http://someUrl.com"
        xmlns="http://www.w3.org/1999/XMLSchema"
        xmlns:myNamespace="http://someUrl.com"
>

  <element name="element1" type="myNamespace:element1Type" />

  <type name="element1Type">
    <element name="element2">
      <type content="empty" />
    </element>
  </type>

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

</schema>

That would be right, as I can tell.  My only unsurety is whether it is
correct to omit the namespace before each element's name (in a DTD, of
course, this has to be myNamespace:element1 and myNamespace:element2). 
As far as I can tell, the element is defined, and the namespace listed
in targetNamespace is then applied to all elements named.  That would be
why the type element1Type must be referred to as
myNamespace:element1Type in the definition of the element1 element,
correct?  The namespace is applied to it.  So can someone let me know if
I am reading this right, or if I'm off in left field somewhere ;-)

Thanks,
Brett

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list