how to import xsd schema using relative path
posted 4 years ago
-
1 -
-
Number of slices to send:Optional 'thank-you' note:
-
-
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!
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!
posted 4 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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.
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.
posted 4 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
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).
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).
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
Xinxin Lee
Greenhorn
Posts: 2
posted 4 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thank you all for the input. I will take a look.
Xinxin
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 |











