Well, short version of the story: I am dynamically creating an XML file that is going to describe a directory structure (i.e. folders, subfolders, etc). Obviously, creating the XML file isn’t too bad… but I am having a few problems understanding some things about Schemas. Primarily with namespaces.
I have found a bit of documentation on the web about Schemas, but nothing that has really helped anything “click”, if you know what I mean (it’s really frustrating). I also have a book on XML, but it was before the whole “Schema” era came along-- it focuses on DTDs.
Here are links to the files:
XML file Schema File .
I would greatly appreciate any help/feedback anyone can give me on my files… even if it’s condescending- at this point I don’t care. I just want to understand Schemas!! 
LilShieste
There are programs, such as XMLSpy, that can automatically convert a DTD to a schema. I would use those, as some one-liners in a DTD can be very involved as schemas.
Thanks for the idea, ultrafilter– that is definitely something to keep in mind. Even still, I really want to just figure this namespace thing out.
Heck, for all I know, I may even be doing it right…
LilShieste
I think you’re close. You need a minOccurs=1 maxOccurs=1 on your name element of the directory, and it needs to be outside of your sequence, since every directory has to have one name and exactly one name. Then your file and directory children of directory and root have to have a minOccurs=1.
I’m not positive that sequence is the right complexType you want, but I’d need references I have at work to tell you for sure.
-lv
Ack! Then your file and directory children of directory and root have to have a minOccurs=0, because not every directory will have a file in it or a directory in it.
-lv
I will try adding those attributes and see what happens, thanks LordVor.
And yeah, the recursive nature of this schema doesn’t make things any easier. My fault. 
LilShieste
Oops… nevermind. I won’t add the attributes, since they don’t help me. hehe Yeah, time for another Code Red Mt. Dew.
LilShieste
OK, my last try at this without my references from work:
I think you’re trying for something like:
<dir:element name=“directory”>
<dir:complexType>
<dir:element ref=“name” />
<dir:sequence minOccurs=“0”; maxOccures=“Unbounded”>
<dir:element ref=“directory” />
<dir:element ref=“file” />
</dir:sequence>
</dir:complexType>
</dir:element>
That makes a directory a complexType with a required name field followed by 0 or more sequences of either directory or file. However, it might be saying 0 or more sequences of a directory element AND a file element, in which case sequence isn’t the right keyword, but I can’t find the right one from here.
Of course, the messageboard is eating my tabbing…
-lv
Thanks for your help, LordVor, what you’re doing makes sense to me. Did you see anything wrong with my namespaces? Or was I worrying about nothing? 
LilShieste
I think the namespaces are fine…but that’s not my strong spot. I think you may be doing more than is technically necessary, because I could barely find anything on those keywords over at xml.org. Here’s the only example I could find:
<logml xmlns=“http://www.cs.rpi.edu/LOGML”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://www.cs.rpi.edu/LOGML
http://www.cs.rpi.edu/~puninj/LOGML/logml.xsd”
start_date=“12/Oct/2000:05:00:05”
end_date=“12/Oct/2000:16:00:01”>
It looks roughly like yours…
-lv
ahhh ok. Yeah, most of my information was gathered from the W3C website(s) so… it probably is unnecessary… for the most part.
Well, thanks again for all your help, LordVor. I think my revised XML and XSD files are now ready to work with, for any purposes I need to use it for anyway.
LilShieste
After checking references, I’m still unsure how namespaces work, but the other keyword I was thinking of would be “choice” instead of “sequence”, I think that’s what you really want, a 0-infinity repettition of a choice between files and directories.
-lv
oooOOOooo Now that sounds like a handy-dandy element I can use. Thanks again!
LilShieste