Discussion in 'XML' started by pauljwilliams, May 8, 2006.

  1. Im trying to use an xml file that has a reference within it to an xsd
    file in a schemaLocation element.

    The xsd file is in the same directory as the xml file, so i've simply


    <jxb:bindings schemaLocation="protocol.xsd" node="/xs:schema">

    All works fine....until my source root is located in a path that has
    spaces in it. In other words, if the two files reside in c:/code, for
    example, all is well - the schemaLocation obviously gets internally
    tranlated to c:/code/protocol.xsd.

    But if i then copy the code into "c:/My Code", for example, the xml
    becomes ill formed, as scemaLocation becomes "c:/My Code/protocol.xsd",
    with the space causing a problem.

    Any thoughts on how to get around this? Is there a way to specify a URL
    encoded path that will be correct wherever i locate my source tree?
    pauljwilliams, May 8, 2006
    1. Advertisements

  2. Apologies for the thread title BTW - I should check what I'm cutting
    and pasting......
    pauljwilliams, May 8, 2006
    1. Advertisements

  3. That's a problem with the specific tool (probably the specific parser)
    you're using. Complain to their support channel.
    Joseph Kesselman, May 8, 2006
  4. If you were to treat the filename as a relative file: URL (which would
    then get absolutised to file:///c:/code/protocol), you could use
    %20 in the URL instead of spaces, e.g. file:///c:/My%20Code

    Whether this works depends on whether your application can handle URLs
    instead of filenames.
    It's not ill-formed XML, it's just something your application doesn't

    Incidentally, you would have a similar problem with the standard
    xsi:schemaLocation attribute, which uses spaces as separators. But
    the location in that case is a URL anyway, so you could use %20.

    -- Richard
    Richard Tobin, May 8, 2006
  5. Thanks for your responses. Im using xjc, as part of Sun JAXB toolkit,
    to generate Java classes based on an XML schema. I'll have a look for a

    Thanks again.
    pauljwilliams, May 8, 2006
  6. pauljwilliams


    May 22, 2013
    Likes Received:
    Awesome! Thanks for that!
    Aries86, May 22, 2013
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.