3

Here is a really stupid question, but I don't know the answer to it so try not to giggle too much. I am learning how to create an xsd file. I have created one following various howtos online. The thing I don't know how to do (and is never mentioned in the tutorials) is how do I reference this xsd in other xml and xslt files? The xsd isn't hosted on a website and I don't want it to be since it is only for internal use. So my question is, how do I accomplish this?

Mathias Müller
  • 22,203
  • 13
  • 58
  • 75
user5013
  • 981
  • 4
  • 10
  • 21
  • 2
    Not a stupid question, but it's been asked before: [How to reference a local xml schema file correctly?](http://stackoverflow.com/q/19253402/290085). – kjhughes Aug 08 '14 at 19:12

1 Answers1

1

There are two way to solve this problem...

first one:

<xs:import namespace="http://www.example.org/Something" schemaLocation="path/of/your/xsd/file.xsd" />

second one:

Build a catalog file to identify namespace to the resource .. see here

(e.g. from http://mojo.codehaus.org/xml-maven-plugin/examples/catalog.html)

  <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <public publicId="http://www.w3.org/1999/XSL/Transform" uri="./schema-for-xslt20.xsd"/>
    <system systemId="http://www.example.com/sample.dtd" uri="./sample.dtd"/>
  </catalog>
Xstian
  • 8,184
  • 10
  • 42
  • 72