[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML Schemas: elementFormDefault - to qualify or not?
My interpretation is that 2 is the closest to correct. The only way to "reach" a local element is in the context of the content model it was defined, but you can bring its context into another namespace. I think that the following would be schema valid (allowing for types) (if sample has an <any/> content model). <sample xmlns="http://www.example.org" xmlns:pub="http://www.publishing.org"> <!-- non URI would be not schema valid --> <pub:title>http://www.example.org/titles/catch22.xml</pub:title> </sample> <exam:sample xmlns:exam="http://www.example.org" xmlns="http://www.publishing.org"> <title>http://www.example.org/titles/catch22.xml</title> </exam:sample> <exam:sample xmlns:exam="http://www.example.org" xmlns="http://www.publishing.org"> <BookCatalog> <Book> <Title><-- any string content allowed here -->Les Miserables</Title> <Author>Victor Hugo</Author> <Date></Date> <ISBN></ISBN> <Publisher></Publisher> </Book> </BookCatalog> <exam:sample> <sample xmlns="http://www.example.org" xmlns:pub="http://www.publishing.org"> <pub:BookCatalog> <pub:Book> <pub:Title><-- any string content allowed here -->Les Miserables</exam:Title> <pub:Author>Victor Hugo</exam:Author> <pub:Date></exam:Date> <pub:ISBN></exam:ISBN> <pub:Publisher></exam:Publisher> </pub:Book> </pub:BookCatalog> <sample> If elementForm was unqualified, the following would be legal (and the previous two illegal) <exam:sample xmlns:exam="http://www.example.org" xmlns="http://www.publishing.org"> <pub:BookCatalog xmlns="" xmlns:pub="http://www.publishing.org"> <Book> <Title><-- any string content allowed here -->Les Miserables</Title> <Author>Victor Hugo</Author> <Date></Date> <ISBN></ISBN> <Publisher></Publisher> </Book> </pub:BookCatalog> <exam:sample> <sample xmlns="http://www.example.org" xmlns:pub="http://www.publishing.org"> <pub:BookCatalog> <Book> <Title><-- any string content allowed here -->Les Miserables</exam:Title> <Author>Victor Hugo</exam:Author> <Date></exam:Date> <ISBN></exam:ISBN> <Publisher></exam:Publisher> </Book> </pub:BookCatalog> <sample> There is no way to use the Book, local Title, Author, Date, ISBN, and Publisher elements from another schema (except in the context of an BookCatalog element).
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|