namespace relative path trouble..

Discussion in 'XML' started by ax, Oct 27, 2006.

  1. ax

    ax Guest

    Dear Experts,

    I really worry about the following problem..

    There is one XML File on my PC located at C:\Test. Hence, there are 2
    XSD files on the same path
    [ C:\Test ] I make an absolut reference in the XML file to the 2 XSD
    files.

    xmlns:address="C:\Test\file_address.xsd"
    xmlns:hobby="C:\Test\file_hobby.xsd"


    XML Spy Validator validates correctly the XML as long as i dont move
    the files into another directory.

    How can i formulate

    xmlns:address="blablablabla\file_address.xsd" to look in the SAME
    folder as the XML is located?
     
    ax, Oct 27, 2006
    #1
    1. Advertising

  2. ax wrote:
    > xmlns:address="C:\Test\file_address.xsd"
    > xmlns:hobby="C:\Test\file_hobby.xsd"


    Don't confuse namespace names and schema locations. A namespace is not
    guaranteed to be the location of the schema, and in fact more commonly
    is NOT.

    And that's a broken namespace name in any case. Namespace names should
    be absolute URI references; the use of relative references was
    DEPRECATED after a long and painful debate which concluded that there
    was no agreed-upon way to interpret them. Unless you're considering C:
    to be a URI scheme -- which I doubt! -- this filename is not a URI. You
    meant "file:///C:\Test\file_address.xsd", and even that is a VERY poor
    choice for a namespace name since it's too likely that someone else may
    use the same string. Pick a real URI based on a domain name you control,
    to ensure against namespace collision.

    > How can i formulate
    > xmlns:address="blablablabla\file_address.xsd" to look in the SAME
    > folder as the XML is located?


    Good example of why not to confuse these.

    Namespace names should be absolute URI references; the use of relative
    references was DEPRECATED after a long and painful debate which
    concluded that there was no agreed-upon way to interpret them. But you
    want a relative reference to your schema.

    Divide the issue. Use a real URI for the namespace name, as discussed
    above, and then provide additional direction for where to look for that
    schema, typically by using the xsi:schemaLocation attribute.

    http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/#schemaLocation



    If XML Spy doesn't support schemalocation or some equivalentmechanism
    for distinguishing between a namespace name and the schema which defines
    that namespace -- if it insists that the namespace is the schema
    location -- it's broken. Change tools.


    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Oct 27, 2006
    #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. Matt
    Replies:
    3
    Views:
    19,625
    Sudsy
    Jul 8, 2004
  2. Thomas Guettler
    Replies:
    3
    Views:
    772
    Andrei
    Oct 27, 2003
  3. Echo
    Replies:
    0
    Views:
    291
  4. Oren
    Replies:
    1
    Views:
    558
    Michael D. Ober
    Apr 29, 2007
  5. Nigel Wilkinson
    Replies:
    2
    Views:
    399
    Nigel Wilkinson
    Jul 25, 2005
Loading...

Share This Page