• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

how to import xsd schema using relative path

 
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on validating xml using xsd schema.  The xml has multiple namespaces so I have to import one xsd schema file (on my local drive) in another xsd schema file.
this is the import statement in the top schema .xsd -


Importing using absolute path works, but I cannot do that when running in pipeline.  I have tried using different combinations of relative path but none worked.  Any suggestions?  Thanks!
 
Marshal
Posts: 28492
113
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Xinxin, welcome to the Ranch!

That isn't the right way to construct a schemaLocation attribute. It's supposed to have two parts, a namespace URI and a URL where the schema can be found. See this page from an O'Reilly book for an explanation.

It's possible to use a file:// URL in that location, but apparently your XML parser will accept a Windows path name as well. You didn't describe that "pipeline" but if it's running on a different computer then naturally it isn't going to be able to find your schema on its C: drive.
 
Saloon Keeper
Posts: 29003
214
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's important to note that a validating XML parser typically has a schema resolution mechanism. This supports local caching of schemas as well as the ability to validate schemas will not connected to the Internet.

It also supports getting schemas from locations that don't have a direct access, such as schemas stored within a JAR file.

So it's actually more important that you make the schema resolver happy than it is to use filesystem paths (whether relative or absolute).
 
Xinxin Lee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for the input.  I will take a look.
Xinxin
 
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic