Strange (to me) import statements

Charles Fineman

Usenet Archive
Joined
Dec 18, 2003
Messages
13
Reaction score
0
I've been asked to look over an integration toolkit that has a bunch of schemas to specify message format. There are a couple of strange things I noticed right off the bat and I wanted to get others' thoughts on it (disclaimer, obviously I'm no XML expert so forgive me if these are basic).

--------Exhibit A: The start of a response message-----------------

<xsd:schema targetNamespace="http://www.QQQ.com" xmlns:QQQ="http://www.QQQ.com/datatypes" xmlns="http://www.QQQ.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">

<xsd:import namespace="http://www.QQQ.com/datatypes" schemaLocation="../general/datatypes.xsd"/>

<xsd:import namespace="http://www.QQQ.com"
schemaLocation="../general/datatypes.xsd"/>

--------Exhibit B: The start of general/datatypes.xsd --------------

<xsd:schema targetNamespace="http://www.QQQ.com/datatypes" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.QQQ.com/datatypes" elementFormDefault="unqualified" attributeFormDefault="unqualified">

#1) Exhibit A seems to be following poor form by using such a generic targetNamespace (the same one is used for all their top-level schema). The convention I've seen is that the targetNamespace should be the public URL of the document.

#2) Exhibit A defines both the default and QQQ namespace to point to the same schema (namely, Exhibit B). I guess I don't have a problem with it technically (sans #3) but it does seem bizarre. Seems like a really bad idea in fact. Would you do this so you could normally refer to a name X without qualification unless there were some ambiguity with an X in the current document (and so you could refer to it as QQQ:X)?

#3) The namespace used in the 2nd import of Exhibit A does not match the targetNamespace of Exhibit B. Why would someone do this?

#4) Please confirm/dispute my interpretation of the elementForDefault and the attributeFormDefault: all these say is that I do not have to qualify elements in the document but they are still implicitly part of the default namespace for that document (and hence would be subject to the appropriate validations).

If this is all just bad form, so be it (and I may have a chance to get it fixed) but if there are plausible reasons for why one would do things this way I sure would like to hear about them.

Thanks,

Charlie Fineman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,224
Members
248,132
Latest member
henrywalsh

Latest Threads

Top