OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] Can schema stand alone?

[ Lists Home | Date Index | Thread Index ]

> I'm pretty new to XML and have only been reading this list a few days, so
> please forgive me if this seems like a really stupid question...

Not stupid at all...

> From what I've seen so far DTD would work perfectly, but I get the feeling
> after reading this list and other sources that DTD is "on the skids" and
> likely to become obsolete and that Schema is generally considered the
> -- if that is not correct, please let me know as I can quite happily
> implement this in DTD!

Obsolete is a very strong word-- though "XML Schema is the future" that is
strong hype. XML Schema will most likely be the more common format in the
near future, but DTDs aren't going away anytime soon. That said, if you can
happily implement your application using a DTD then by all means use a DTD--
why keep from being happy? : )

> I've been reading up on schemas and every example I've seen so far starts
> referencing the schema namespace at w3c.org (i.e. <xs:schema
> xmlns:xs="http://www.w3.org/2001/XMLSchema";>).  Is this required for
> schemas to operate?

Yes and no. This is required for the namespaces within the document to
function properly. Technically a <schema> element from the namespace
http://www.w3.org/2001/XMLSchema and a <schema> element from some other
namespace are two completely different things even though they look like the
same name ("schema"). The namespace declaration is _only a name_. (no flames
please!) Unless you are using something like RDDL to resolve the namespace
to some document (which can be useful). That said, I don't know of any
Schema processor that tries to do this.

> If so, it seems to conflict with my requirement that the data
> be complete and usable even without access to the internet.  (It also
> that a lot of developers must be really sticking their necks out on
> something that they have absolutely no control over, i.e. that W3C won't
> change or move the namespace definition.  I used to do risk analysis for
> software development and this scenario would have had us passing out by
> numbers.)

Think of it more as a name and it makes sense. You _can_ resolve the
namespace but you must code it to do so. In order to refer to the actual
schema (according to the XML Schema rec) you need to include the attribute
xsi:schemaLocation or xsi:noNamespaceSchemaLocation. This allows you to look
up the file (which is very often stored locally).

> Does the schema syntax stand alone in the absence of the xs namespace
> reference?  I.e. would it be possible (and reasonable) to define my own
> namespace (something like <myschema:schema
> xmlns:myschema="my_local_file_reference">) and to NOT reference the xs
> namespace at all?


> Can you describe, in a nutshell, the perceived advantage that Schema has
> over DTD?

You are able to assign types to the character data within the element. You
are also able to model more complex structures, use inheritence and define
it all in an XML syntax (versus DTD). There are several other advantages...

> Finally, if you could own only one reference on XML, suitable for
> experienced software developers who are new to XML, what would it be?

I am obliged to recommend Beginning XML 2E from (Wrox) : ) But if I was told
I had to throw out all of my XML related books but one-- I would keep
Michael Kay's XSLT (Wrox). That won't really help you for this project...
but Wow... it is great.

Hope this helps,
Jeff Rafter
Defined Systems
XML Development and Developer Web Hosting


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS