xsd - How to reference a local XML Schema file correctly? -


i'm having problem referencing xml schema in xml file.

i have xsd in path:

c:\environment\workspace\maven-ws\projectxmlschema\email.xsd 

but when in xml file i'm trying locate schema this, xsd not found:

<?xml version="1.0" encoding="utf-8" ?>     <email xmlns="http://www.w3schools.com"            xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"            xsi:schemalocation="http://www.w3schools.com                  file://c://environment//workspace//maven-ws//projextxmlschema//email.xsd"> 

the way xsd found when it's in same folder:

           xsi:schemalocation="http://www.w3schools.com email.xsd" 

so question this: how path have xsd found if xml file wasn't in same folder xsd file?

by way, example i've been using msdn: they're claiming it's supposed work way tried to. doesn't.

add 1 more slash after file:// in value of xsi:schemalocation. (you have two; need three. think protocol://host/path protocol 'file' , host empty here, yielding 3 slashes in row.) can eliminate double slashes along path. believe double slashes file systems allow spaces in file , directory names, wisely avoided complication in path naming.

xsi:schemalocation="http://www.w3schools.com file:///c:/environment/workspace/maven-ws/projextxmlschema/email.xsd" 

still not working? suggest copy full file specification xsd address bar of chrome or firefox:

file:///c:/environment/workspace/maven-ws/projextxmlschema/email.xsd

if xsd does not display in browser, delete last component of path (email.xsd) , see if can't display parent directory. continue in manner, walking directory structure until discover path diverges reality of local filesystem.

if xsd does displayed in browser, state xml processor you're using, , prepared hear it's broken or must work around limitation. can tell above fix work xerces-j-based validator.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -