Schema & Namespaces

Discussion in 'XML' started by hooomee@gmail.com, Jun 7, 2006.

  1. Guest

    I'm having tons of trouble getting my schema namespace to work. When i
    point the validator at the following two examples, it gives the error:

    Warning at (2,2): Could not find schema information for the element
    'pleaseWork:aWidget'.

    I'm trying to validate it using:
    http://apps.gotdotnet.com/xmltools/xsdvalidator/default.aspx

    What am I missing/not understanding? I'm familiar with namespaces
    from C++, but cant seem to get this right.


    instance.xml:
    <?xml version="1.0" encoding="utf-8" ?>
    <aWidget xmlns="pleaseWork">
    <Model>3x4x1.5</Model>
    </aWidget>

    namespace.xsd:
    <?xml version="1.0" encoding="utf-8" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="pleaseWork" xmlns="pleaseWork" >
    <xs:element name="aWidget" type="Widget" />
    <xs:complexType name="Widget">
    <xs:all>
    <xs:element name="Model" type="xs:string" />
    </xs:all>
    </xs:complexType>
    </xs:schema>
     
    , Jun 7, 2006
    #1
    1. Advertising

  2. First thing to fix: Namespace names should be absolute URIs.
     
    Joe Kesselman, Jun 7, 2006
    #2
    1. Advertising

  3. Guest

    yes, i know they "should" be URI's but that is not required, its just
    commen ( and good ) practice to use them. I removed the URI's i had
    trying to reduce the problem and make it simpler. If you replace
    "pleaseWork" with "http://www.google.com" in both documents it makes no
    difference.


    Joe Kesselman wrote:
    > First thing to fix: Namespace names should be absolute URIs.
     
    , Jun 7, 2006
    #3
  4. wrote:

    > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    > targetNamespace="pleaseWork" xmlns="pleaseWork" >


    Remove that xmlns="pleaseWork" and add
    elementFormDefault="qualified"
    as an attribute to the xs:schema element.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jun 7, 2006
    #4
  5. Guest

    Using the following documents I get this error:

    Type 'Widget' is not declared.

    namespace.xsd:
    <?xml version="1.0" encoding="utf-8" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="pleaseWork" elementFormDefault="qualified" >
    <xs:element name="aWidget" type="Widget" />
    <xs:complexType name="Widget">
    <xs:all>
    <xs:element name="Model" type="xs:string" />
    </xs:all>
    </xs:complexType>
    </xs:schema>

    instance.xml:
    <?xml version="1.0" encoding="utf-8" ?>
    <aWidget xmlns="pleaseWork">
    <Model>3x4x1.5</Model>
    </aWidget>
     
    , Jun 7, 2006
    #5
  6. In article <44870be6$0$11080$-online.net>,
    Martin Honnen <> wrote:

    >> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    >> targetNamespace="pleaseWork" xmlns="pleaseWork" >


    >Remove that xmlns="pleaseWork"


    No, it's needed for the reference to the type Widget in the element
    declaration of aWidget.

    > and add elementFormDefault="qualified"
    >as an attribute to the xs:schema element.


    Yes, this is the problem. The declaration of the element Model is
    a local declaration, and by default it declares the element with no
    namespace.

    -- Richard
     
    Richard Tobin, Jun 7, 2006
    #6
  7. Andy Dingley Guest

    Joe Kesselman wrote:
    > First thing to fix: Namespace names should be absolute URIs.


    Why? They need to be URIs, but what requires them to be absolute?

    Obviously document portability suffers if they're not, but this
    shouldn't affect validity within a local system (i.e. the actual
    resolution of the URI remains constant within the scope of all document
    instances)
     
    Andy Dingley, Jun 8, 2006
    #7
  8. Andy Dingley <> wrote:
    >> First thing to fix: Namespace names should be absolute URIs.

    > Why? They need to be URIs, but what requires them to be absolute?


    The W3C debated this at painful length, and concluded that there were
    too many conflicting views of what a relative namespace should mean, if
    anything. (Think about it. The namespace asserts the semantic intent of
    the document. Do you really want a document's intent to change because
    you copy it from one directory to another, even on a single machine? Do
    you want to deal with the fact that two URIs may resolve to the same
    thing but can't be proven to do so?) The conclusion was that relative
    namespace URIs should deprecated, and their behavior is explicitly
    undefined, until and unless the Semantic Web folks come back to us with
    a proposal that makes them meaningful ... and at that time, a lot of
    code is going to have to be revisited.

    Meanwhile, applications are free to reject relative namespace URIs, or
    to compare them as literal strings, or to try to compare them as
    resolved... in other words, the behavior is unpredicatable.

    That's good and sufficient reason not to climb into this kettle of worms.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Jun 8, 2006
    #8
  9. In article <>,
    Joe Kesselman <> wrote:

    >>> First thing to fix: Namespace names should be absolute URIs.

    >> Why? They need to be URIs, but what requires them to be absolute?


    >The W3C debated this at painful length, and concluded that there were
    >too many conflicting views of what a relative namespace should mean, if
    >anything.


    They went so far as to have a ballot on the subject. The report of
    the result is at

    http://www.w3.org/2000/09/xppa

    -- Richard
     
    Richard Tobin, Jun 8, 2006
    #9
  10. Richard Tobin wrote:
    > They went so far as to have a ballot on the subject.


    Yeah, I know. I was there. It was rather more interesting than any of us
    really wanted it to be.

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Jun 9, 2006
    #10
    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. Markus
    Replies:
    1
    Views:
    1,558
    Markus
    Nov 23, 2005
  2. Miel Bronneberg

    DTDs, schema's and namespaces

    Miel Bronneberg, Sep 30, 2003, in forum: XML
    Replies:
    2
    Views:
    367
    Miel Bronneberg
    Sep 30, 2003
  3. PA
    Replies:
    0
    Views:
    392
  4. Zombie

    2 namespaces in 1 schema

    Zombie, Aug 18, 2004, in forum: XML
    Replies:
    5
    Views:
    553
    Zombie
    Aug 19, 2004
  5. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,272
    Stanimir Stamenkov
    Apr 25, 2005
Loading...

Share This Page