Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > http://forums.overclockers.co.uk/showthread.php?t=17572829

Reply
Thread Tools

http://forums.overclockers.co.uk/showthread.php?t=17572829

 
 
pauljwilliams@gmail.com
Guest
Posts: n/a
 
      05-08-2006
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
got:

Code:

<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?

 
Reply With Quote
 
 
 
 
pauljwilliams@gmail.com
Guest
Posts: n/a
 
      05-08-2006
Apologies for the thread title BTW - I should check what I'm cutting
and pasting......

 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      05-08-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> All works fine....until my source root is located in a path that has
> spaces in it.


That's a problem with the specific tool (probably the specific parser)
you're using. Complain to their support channel.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      05-08-2006
In article <(E-Mail Removed). com>,
<(E-Mail Removed)> wrote:

><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.


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.

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


It's not ill-formed XML, it's just something your application doesn't
like.

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
 
Reply With Quote
 
pauljwilliams@gmail.com
Guest
Posts: n/a
 
      05-08-2006
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
solution.

Thanks again.

 
Reply With Quote
 
Aries86 Aries86 is offline
Junior Member
Join Date: May 2013
Posts: 1
 
      05-22-2013
Awesome! Thanks for that!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments