0

I have following XSD namespaces:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<xs:import namespace="http://www.w3.org/TR/REC-html40" schemaLocation="a.xsd"/>
<xs:import namespace="urn:schemas-microsoft-com:office:excel" schemaLocation="b.xsd"/>
<xs:import namespace="urn:schemas-microsoft-com:office:office" schemaLocation="c.xsd"/>

this XSD is located on the server, let's say it's url is

http://somehost/xsd/main.xsd

I can easily read it, but I can't read imports which have non-fully qualified name and I guess they have base url the same as main XSD:

http://somehost/xsd/a.xsd
http://somehost/xsd/b.xsd
http://somehost/xsd/c.xsd

How can I validate xml against such XSD?

I probably have to use LSResourceResolver, but I can't implement it correctly. Please help.

Don_Quijote
  • 936
  • 3
  • 18
  • 27

1 Answers1

0

In your example it doesn't seem like you need a resolver, but if you're finding it challenging to write one yourself you may find it easier to use an XML Catalog for remapping URLs. An example of how to do this with Xerces and XML Schema documents is described here. Note that Xerces' XMLCatalogResolver is an LSResourceResolver so can be used where you were planning to insert your custom one.