Strange (to me) import statements

Discussion in 'XML' started by Charles Fineman, Jan 15, 2004.

  1. 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
     
    Charles Fineman, Jan 15, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil Zanella
    Replies:
    8
    Views:
    1,233
    mfmehdi
    Oct 20, 2006
  2. Dennis B. Hansen

    Schema import statements

    Dennis B. Hansen, Aug 4, 2003, in forum: XML
    Replies:
    1
    Views:
    494
    Mike Grayson
    Aug 11, 2003
  3. Harry George
    Replies:
    6
    Views:
    444
    Bart Nessux
    Feb 23, 2004
  4. Vince
    Replies:
    12
    Views:
    776
    Martin Gregorie
    Jan 21, 2008
  5. John Crichton
    Replies:
    6
    Views:
    290
    John Crichton
    Jul 12, 2010
Loading...

Share This Page