How to specify a local (!) Schema file in the same (!) directory as the xml file ?

Discussion in 'XML' started by Till Soerensen, Jun 9, 2004.

  1. I would like to validate a xml file against a xsd file on my hard disc.
    Ok, I could specify the location of the XSD Schema in the instance of the xml file as follows:

    <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///D:/tmp/Personschema.xsd">

    It works.
    But I would like to specify the location of the xsd relative to the xml file.
    That means if I move both xml AND xsd schema to another folder the xml file becomes invalid resp.
    the validation fails because of a missing xsd file.
    On the other hand if i change the Schema location as follows:

    <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Personschema.xsd">

    The XSD file is not longer valid itself because "Personschema.xsd" is not a valid URI.
    So is there another method to specify the Schema location relatively to the xml file ?

    Till
     
    Till Soerensen, Jun 9, 2004
    #1
    1. Advertising

  2. Re: How to specify a local (!) Schema file in the same (!)directory as the xml file ?

    (Till Soerensen) writes:

    > I would like to validate a xml file against a xsd file on my hard disc.
    > Ok, I could specify the location of the XSD Schema in the instance
    > of the xml file as follows:


    </snip/>

    > <Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    > xsi:noNamespaceSchemaLocation="Personschema.xsd">
    >
    > The XSD file is not longer valid itself because "Personschema.xsd"
    > is not a valid URI.


    It's fine -- it's a (relative) URI reference, which is allowed, and
    should work with any conformant schema processor.

    ht
    --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Jun 9, 2004
    #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.

Share This Page