targetnamespace - what is it?!?!

Discussion in 'XML' started by kevin bailey, Jun 24, 2003.

  1. kevin bailey

    kevin bailey Guest

    hi there,

    i'm reading up on schema - but am probably missing something obvious RE
    targetnamespace

    i know there can only be one...

    is it that the elements which are defined in the schema which have no
    prefix are somehow now part of the namespace - would it need to upload the
    definitions?

    it says
    targetnamespace - 'namespace to which all global schema components belong'

    but what the point of that - there is already a default namespace
    xmlns="http://....."

    and anyway - what is a 'global schema component'?

    thanks for ANY help?

    kev bailey
    kevin bailey, Jun 24, 2003
    #1
    1. Advertising

  2. kevin bailey

    kevin bailey Guest

    gabriel wrote:

    > targetNamespace = "THIS" says that "this schema describes elements that
    > belong to THIS namespace". So it sorts of defines a namespace. Then it can
    > get more complicated of course, for instance several schemas can define
    > parts of the same namespace. Let's say one schema describes a "car"
    > element in namespace "asdflj234lk234/namespaces/vehicels", and another
    > schema defines a "truck" element in the same namespace.
    >
    > The xmlns= "THIS" says that all elements and attributes that are NOT
    > prefixed belong to THIS namespace.
    >
    > A global comonent (element) is defined at the "top level" of a schema
    > document. The "car" element is the at the top level, and then I might
    > define that it has wheels elements within the car element. The wheels
    > elements are not global then, they are local.
    > Global elements can be used several times, in different places and levels
    > (not top level again though).
    >
    > a bit more advanced:
    > However, I COULD define a wheel element on the toplevel as well, and thus
    > make it global. They would not be WITHIN the car element then. I could
    > then say that a car has wheels by defining an element within the car that
    > _references_ the global wheel elements with the ref attribute.
    > If and instance was checked against this schema, it would conform if
    > 1) it had a car element with wheels in it
    > 2) it had a wheel only
    >
    > This is because there is no in XSDL way to define a root element. All
    > global elements CAN be the root! (Personally I think that sucks :)
    >
    >


    thanks loads for the reply - after reading it a couple of times it has
    certainly helped to clear some of the mist!!

    am i right in thinking that the targetnamespace is useful when a schema is
    made up from several xsd files all linked together via
    import/include/redefine - it means then that another part of the schema can
    reference an element by using its namespace?

    kev bailey


    > /Gabriel - new to XML as well :)
    >
    >
    >
    > "kevin bailey" <> skrev i meddelandet
    > news:bd9vea$77r$1$...
    >> hi there,
    >>
    >> i'm reading up on schema - but am probably missing something obvious RE
    >> targetnamespace
    >>
    >> i know there can only be one...
    >>
    >> is it that the elements which are defined in the schema which have no
    >> prefix are somehow now part of the namespace - would it need to upload
    >> the definitions?
    >>
    >> it says
    >> targetnamespace - 'namespace to which all global schema components
    >> belong'
    >>
    >> but what the point of that - there is already a default namespace
    >> xmlns="http://....."
    >>
    >> and anyway - what is a 'global schema component'?
    >>
    >> thanks for ANY help?
    >>
    >> kev bailey
    kevin bailey, Jun 25, 2003
    #2
    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. CB
    Replies:
    0
    Views:
    3,296
  2. C. M. Sperberg-McQueen

    Re: transforming to an XML Schema - targetNamespace

    C. M. Sperberg-McQueen, Jul 29, 2003, in forum: XML
    Replies:
    0
    Views:
    523
    C. M. Sperberg-McQueen
    Jul 29, 2003
  3. Charles Fineman

    targetNamespace/import conflict

    Charles Fineman, Jan 21, 2004, in forum: XML
    Replies:
    2
    Views:
    4,193
    Charles Fineman
    Feb 9, 2004
  4. Gianni Rubagotti
    Replies:
    1
    Views:
    535
    Patrick TJ McPhee
    Feb 5, 2004
  5. Markus Meckler
    Replies:
    3
    Views:
    691
    Priya Lakshminarayanan [MSFT]
    Jun 29, 2004
Loading...

Share This Page