Thanks for the reply, Cheng. Unfortunately, the example you provided with that link doesn't involve multiple xsd files - one xsd file including another via an <import> tag with a schemaLocation attribute. The actual xsd and xml files we're using are a
bit large and impracticle to share. But here's a small example. Consider the code...
If we run this code, we get the following output. Note that it indicates only 1 schema present - the 1 should be a 2. Also, it doesn't seem to care about the illegal xml element, <foobarx>.
1 xml foobarx
foobarx
However, if we port that code to a C# console app with the exe in the same folder as foo.xsd, we get the expected output...
2
xml
**** The 'http://curtisdehaven.com/bar:foobarx' element is not declared.
Member
41 Points
137 Posts
Re: XML Schema and imports with relative schemaLocation
Aug 24, 2015 02:04 PM|curtisdehaven|LINK
Thanks for the reply, Cheng. Unfortunately, the example you provided with that link doesn't involve multiple xsd files - one xsd file including another via an <import> tag with a schemaLocation attribute. The actual xsd and xml files we're using are a bit large and impracticle to share. But here's a small example. Consider the code...
And consider the following files...
foo\foo.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:b="http://curtisdehaven.com/bar">
<import namespace="http://curtisdehaven.com/bar" schemaLocation="./bar/bar.xsd"/>
</schema>
foo\bar\bar.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://curtisdehaven.com/bar">
<element name="foobar" type="string"/>
</schema>
If we run this code, we get the following output. Note that it indicates only 1 schema present - the 1 should be a 2. Also, it doesn't seem to care about the illegal xml element, <foobarx>.
1
xml
foobarx
foobarx
However, if we port that code to a C# console app with the exe in the same folder as foo.xsd, we get the expected output...
2
xml
**** The 'http://curtisdehaven.com/bar:foobarx' element is not declared.
foobarx
foobarx